-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/nlp-dev' into development
- Loading branch information
Showing
20 changed files
with
2,194 additions
and
595 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from datetime import datetime | ||
import wandb | ||
from pathlib import Path | ||
import pandas as pd | ||
import numpy as np | ||
import sys | ||
|
||
sys.path.append(str(Path(__file__).parents[2])) | ||
|
||
from desci_sense.evaluation.Evaluation_benchmark import TwitterEval | ||
from desci_sense.evaluation.utils import obj_str_to_dict, get_dataset | ||
|
||
if __name__ == "__main__": | ||
|
||
wandb.login() | ||
|
||
api = wandb.Api() | ||
|
||
#TODO move from testing | ||
run = wandb.init(project="testing", job_type="evaluation") | ||
|
||
# get artifact path | ||
|
||
dataset_artifact_id = ( | ||
'common-sense-makers/filter_evaluation/prediction_evaluation-20240521132713:v0' | ||
) | ||
|
||
# set artifact as input artifact | ||
dataset_artifact = run.use_artifact(dataset_artifact_id) | ||
|
||
# initialize table path | ||
# add the option to call table_path = arguments.get('--dataset') | ||
|
||
# download path to table | ||
a_path = dataset_artifact.download() | ||
print("The path is",a_path) | ||
|
||
# get dataset file name | ||
|
||
table_path = Path(f"{a_path}/prediction_evaluation.table.json") | ||
|
||
|
||
# return the pd df from the table | ||
#remember to remove the head TODO | ||
df = get_dataset(table_path) | ||
|
||
dataset_run = dataset_artifact.logged_by() | ||
|
||
config = dataset_run.config | ||
|
||
Eval = TwitterEval(config=config) | ||
|
||
|
||
|
||
fig1, fig2 = Eval.build_item_type_pie(df=df) | ||
|
||
wandb.log({"item_type_distribution": wandb.Image(fig1)}) | ||
|
||
wandb.log({"allowlist_item_type_distribution": wandb.Image(fig2)}) | ||
|
||
true_df = df[df["True Label"] == 'research'] | ||
|
||
fig1 , fig2 = Eval.build_item_type_pie(true_df) | ||
wandb.log({"research_type_distribution": wandb.Image(fig1)}) | ||
config = obj_str_to_dict(config) | ||
|
||
run.config.update(config) | ||
|
||
wandb.run.finish() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.