Lesson 8 of 10
Submission
The best scenario is re-tuned on all data and written to submission.csv.
Outputs will appear here after the full run. The code is final.
Left: what & whyRight: the code and its real output
8. Submission
submission.csv = the best scenario. The decoder is re-tuned on all out-of-fold predictions, then applied to the test predictions.
The 2nd and 3rd best are saved too (submission_rank2.csv, submission_rank3.csv).
Pick by CV, not by the public leaderboard: the public part is only a slice of the test set.
prog.start("write submissions") ranked = sorted(rows, key=lambda r: -r["score"][0]) for i, r in enumerate(ranked[:3]): o, t = r["out"] prm = r["fit"](o, y, W_tr, MT_tr) pred = r["apply"](t, prm, MT_te) fname = "submission.csv" if i == 0 else f"submission_rank{i + 1}.csv" pd.DataFrame({"ID": test["space_id"], "price_tier": pred.astype(int) + 1}).to_csv(WORK / fname, index=False) print(f"{fname:24s} ← {r['scenario']} | {r['decoder']} | CV (test-weighted) {r['score'][0]:.4f}") prog.finish() pd.read_csv(WORK / "submission.csv").price_tier.value_counts().sort_index()