Skip to content

Commit

Permalink
change metric output to anndata
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Apr 17, 2024
1 parent 931cf38 commit be63485
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/task/metrics/mean_rowwise_rmse/script.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pandas as pd
import json
import anndata as ad

## VIASH START
par = {
"de_test": "resources/neurips-2023-data/de_test.parquet",
"prediction": "resources/neurips-2023-data/output_rf.parquet",
"output": "resources/neurips-2023-data/score_rf.json",
"de_test": "resources/neurips-2023-data/de_test.parquet",
"prediction": "resources/neurips-2023-data/output_rf.parquet",
"output": "resources/neurips-2023-data/score.h5ad",
}
## VIASH END

Expand All @@ -24,10 +24,14 @@

mean_rowwise_rmse /= de_test.shape[0]

output = {
"mean_rowwise_rmse": mean_rowwise_rmse
}
# prepare output
output = ad.AnnData(
uns = {
"dataset_id": "unknown",
"method_id": "unknown",
"metric_ids": ["mean_rowwise_rmse"],
"metric_values": [mean_rowwise_rmse]
}
)

# write to file
with open(par["output"], 'w') as f:
json.dump(output, f)
ad.write_h5ad(par["output"], output, compression="gzip")

0 comments on commit be63485

Please sign in to comment.