I solved the issue above with: pd.DataFrame(predictions).to_csv(“predictions.csv”)
But then comes the next problem. Uploading of the predictions is not working.
This line of code:
napi.upload_predictions(“predictions.csv”, model_id=“my model”)
yields the following error message:
Specified model_id is not a UUID
OK, you need to do something like this to put id and predictions headers in your submission csv:
#download live data
current_round = napi.get_current_round(tournament=8)
napi.download_dataset("v4/live_int8.parquet", f"live_{current_round}_int8.parquet")
live_data = pd.read_parquet(f"live_{current_round}_int8.parquet")
#put predictions into live data dataframe
live_data["prediction"] = model.predict(live_data[feature_names])
#make new dataframe with only the index (contains ids)
predictions_df = live_data.index.to_frame()
#copy predictions into new dataframe
predictions_df["prediction"] = live_data["prediction"].copy()
#csv file will have only id and prediction headers/columns
predictions_df.to_csv("predictions.csv", index=False)
submission_id = napi.upload_predictions("predictions.csv", model_id=model_id)
I’m sure there’s more elegant code to do this. This is just my amateur hack code.