Skip to content
Snippets Groups Projects
Commit 468ddc75 authored by Tamino Huxohl's avatar Tamino Huxohl
Browse files

introduce pandas and saving to csv in eval script

parent 6a73a952
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ if __name__ == "__main__": ...@@ -94,7 +94,7 @@ if __name__ == "__main__":
) )
measures = {"NMAE": nmae, "MSE": mse} measures = {"NMAE": nmae, "MSE": mse}
values = pd.Dataframe(map(lambda x: (x, []), measures.keys())) values = pd.DataFrame(dict(map(lambda x: (x, []), measures.keys())))
for i, (recon, mu_map) in enumerate(dataset): for i, (recon, mu_map) in enumerate(dataset):
print( print(
f"Process input {str(i):>{len(str(len(dataset)))}}/{len(dataset)}", end="\r" f"Process input {str(i):>{len(str(len(dataset)))}}/{len(dataset)}", end="\r"
...@@ -104,12 +104,15 @@ if __name__ == "__main__": ...@@ -104,12 +104,15 @@ if __name__ == "__main__":
prediction = prediction.squeeze().cpu().numpy() prediction = prediction.squeeze().cpu().numpy()
mu_map = mu_map.squeeze().cpu().numpy() mu_map = mu_map.squeeze().cpu().numpy()
row = dict( row = pd.DataFrame(dict(
map(lambda item: (item[0], item[1](prediction, mu_map)), measures.items) map(lambda item: (item[0], [item[1](prediction, mu_map)]), measures.items())
) ))
values = values.append(row, ignore_index=True) values = pd.concat((values, row), ignore_index=True)
print(f" " * 100, end="\r") print(f" " * 100, end="\r")
if args.out:
values.to_csv(args.out, index=False)
print("Scores:") print("Scores:")
for measure_name, measure_values in values.items(): for measure_name, measure_values in values.items():
mean = measure_values.mean() mean = measure_values.mean()
......
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