-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
…//github.com/Lyon-NLP/mtebscripts into 69-get-models-performance-on-other-languages
@@ -0,0 +1,73 @@ | |||
import os |
There was a problem hiding this comment.
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", | ||
) | ||
|
||
|
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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)
…//github.com/Lyon-NLP/mtebscripts into 69-get-models-performance-on-other-languages
All in a CSV file:
Note:
model_short
column is the model name without the prefix