add practical error column

This commit is contained in:
Luna 2023-06-10 18:36:12 -03:00
parent d299e68526
commit faeb1fd7b3

10
main.py
View file

@ -472,7 +472,12 @@ def plot2(output_path, normalized_scores, model_scores):
def plot3(output_path, normalized_scores, model_scores):
data_for_df = {"model": [], "errors": [], "rating_errors": []}
data_for_df = {
"model": [],
"errors": [],
"rating_errors": [],
"practical_errors": [],
}
for model in sorted(
normalized_scores.keys(),
@ -488,9 +493,11 @@ def plot3(output_path, normalized_scores, model_scores):
for rating in ["general", "sensitive", "questionable", "explicit"]
if rating in score_data["incorrect_tags"]
)
practical_absolute_error = total_incorrect_tags - total_rating_errors
data_for_df["errors"].append(total_incorrect_tags)
data_for_df["rating_errors"].append(total_rating_errors)
data_for_df["practical_errors"].append(practical_absolute_error)
data_for_df["model"].append(model)
df = pd.DataFrame(data_for_df)
@ -499,6 +506,7 @@ def plot3(output_path, normalized_scores, model_scores):
data=[
go.Bar(name="incorrect tags", x=df.model, y=df.errors),
go.Bar(name="incorrect ratings", x=df.model, y=df.rating_errors),
go.Bar(name="practical error", x=df.model, y=df.practical_errors),
]
)
pio.write_image(fig, output_path, width=1024, height=800)