-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made plot nicer, linted, other minor things
- Loading branch information
Showing
11 changed files
with
214 additions
and
152 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,27 +1,31 @@ | ||
# Check grounding of replies by GPT | ||
# Loop over replies, for each MONDO ID make dict entry with | ||
# Loop over replies, for each MONDO ID make dict entry with | ||
# mondo_id: [gpt reply] | ||
# it's an array, mondo id returns a list of labels, check how many non unique | ||
# than put into df and add a third column with actual mondo_id and save to excel | ||
from malco.post_process.post_process_results_format import read_raw_result_yaml | ||
import os | ||
|
||
import pandas as pd | ||
|
||
filepath = "/Users/leonardo/git/malco/out_multlingual_nov24/raw_results/multilingual/en/results.yaml" | ||
from malco.post_process.post_process_results_format import read_raw_result_yaml | ||
|
||
filepath = ( | ||
"/Users/leonardo/git/malco/out_multlingual_nov24/raw_results/multilingual/en/results.yaml" | ||
) | ||
|
||
|
||
if os.path.isfile(filepath): | ||
data = [] | ||
|
||
all_results = read_raw_result_yaml(filepath) | ||
|
||
for this_result in all_results: | ||
extracted_object = this_result.get("extracted_object") | ||
ne = this_result.get("named_entities") | ||
if extracted_object and ne: | ||
label = extracted_object.get("label") | ||
gptinput = this_result.get("input_text") | ||
data.append({"label": label, "gpt_reply": gptinput ,"grounded_response": ne}) | ||
data.append({"label": label, "gpt_reply": gptinput, "grounded_response": ne}) | ||
|
||
df = pd.DataFrame(data, index=1) | ||
df['gpt_reply'].iloc[0].rstrip().split('\n') | ||
df["gpt_reply"].iloc[0].rstrip().split("\n") |
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.