Skip to content
Snippets Groups Projects
Commit 4bcad216 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Corrected problem in labels key where total counts per annotation were misreported

parent b973846b
No related branches found
No related tags found
No related merge requests found
...@@ -223,12 +223,12 @@ def transfer_ecotaxa_labels_to_patch_stacks( ...@@ -223,12 +223,12 @@ def transfer_ecotaxa_labels_to_patch_stacks(
# export annotation classes and their summary stats # export annotation classes and their summary stats
df_tr, df_te = train_test_split(df_pl, train_size=tr_split) df_tr, df_te = train_test_split(df_pl, train_size=tr_split)
df_labels['counts'] = df_pl['annotation_class_id'].value_counts() # df_labels['counts'] = df_pl['annotation_class_id'].value_counts()
df_labels = pd.merge( df_labels = pd.merge(
df_labels, df_labels,
pd.DataFrame( pd.DataFrame(
[df_tr.annotation_class_id.value_counts(), df_te.annotation_class_id.value_counts()], [df_pl.annotation_class_id.value_counts(), df_tr.annotation_class_id.value_counts(), df_te.annotation_class_id.value_counts()],
index=['to_train', 'to_test'] index=['total', 'to_train', 'to_test']
).T, ).T,
left_on='annotation_class_id', left_on='annotation_class_id',
right_index=True, right_index=True,
...@@ -236,7 +236,7 @@ def transfer_ecotaxa_labels_to_patch_stacks( ...@@ -236,7 +236,7 @@ def transfer_ecotaxa_labels_to_patch_stacks(
) )
df_labels.loc[df_labels.to_train.isna(), 'to_train'] = 0 df_labels.loc[df_labels.to_train.isna(), 'to_train'] = 0
df_labels.loc[df_labels.to_test.isna(), 'to_test'] = 0 df_labels.loc[df_labels.to_test.isna(), 'to_test'] = 0
for col in ['to_train', 'to_test', 'counts']: for col in ['total', 'to_train', 'to_test']:
df_labels.loc[df_labels[col].isna(), col] = 0 df_labels.loc[df_labels[col].isna(), col] = 0
df_labels.to_csv(Path(where_output) / 'labels_key.csv', index=False) df_labels.to_csv(Path(where_output) / 'labels_key.csv', index=False)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment