Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute average performance of models over all tasks #71

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

imenelydiaker
Copy link

@imenelydiaker imenelydiaker commented Feb 8, 2024

All in a CSV file:

  • Average performance over each task
  • Overall average performance
  • Models ranking

Note: model_short column is the model name without the prefix

@imenelydiaker imenelydiaker linked an issue Feb 8, 2024 that may be closed by this pull request
@@ -0,0 +1,73 @@
import os

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modify file name => compute_average_performance instead of avergae

format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more elegant way : use os.path.basename(model_name) will return the last part of a path (the model name)

new_df.insert(0, "overall_avg", overall_avg)

new_df.reset_index(inplace=True)
models_short_name = new_df.model.apply(lambda x: models_name_to_index[x])
Copy link

@MathieuCiancone MathieuCiancone Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can simplify code and avoid storing the index mapping, then computing on a new dataframe, then reseting the index. You can compute directly averages on level 0, and change the columns name by prefixing with "avg_"

# Compute average on each task type
averaged_df = result_df.T.groupby(level=0).mean().T
# change column names by prefixing with "avg_"
averaged_df.columns = [f"avg_{col.lower()}" for col in averaged_df.columns]
# compute overall average
averaged_df.insert(0, "avg_overall", averaged_df.mean(axis=1))
# only keep model name in path
averaged_df.index = averaged_df.index.map(os.path.basename)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get average performance over all tasks
2 participants