プリンキピア

第5章多層パーセプトロン

5.7.8. Submitting Predictions on Kaggle5.7.8 Kaggleに予測を提出する

Now that we know what a good choice of hyperparameters should be, we might calculate the average predictions on the test set by all the K models. Saving the predictions in a csv file will simplify uploading the results to Kaggle. The following code will generate a file called submission.csv.
英語のヒント
ハイパーパラメータのよい選び方がわかったので、K個のモデルすべてによるテスト集合での予測の平均を計算することにしよう。予測をcsvファイルに保存しておくと、結果をKaggleにアップロードするのが簡単になる。次のコードは、submission.csvという名前のファイルを生成する。
preds = [model(torch.tensor(data.val.values.astype(float), dtype=torch.float32))
         for model in models]
# Taking exponentiation of predictions in the logarithm scale
ensemble_preds = torch.exp(torch.cat(preds, 1)).mean(1)
submission = pd.DataFrame({'Id':data.raw_val.Id,
                           'SalePrice':ensemble_preds.detach().numpy()})
submission.to_csv('submission.csv', index=False)
Next, as demonstrated in Fig. 5.7.3, we can submit our predictions on Kaggle and see how they compare with the actual house prices (labels) on the test set. The steps are quite simple:
英語のヒント
次に、図5.7.3に示すように、Kaggleに予測を提出し、テスト集合での実際の住宅価格(ラベル)と比べてどうかを見られる。手順はとても簡単である。
  • Log in to the Kaggle website and visit the house price prediction competition page.
    英語のヒント
    Kaggleのウェブサイトにログインし、住宅価格の予測のコンペティションのページを開く。
  • Click the “Submit Predictions” or “Late Submission” button.
    英語のヒント
    「Submit Predictions」または「Late Submission」ボタンをクリックする。
  • Click the “Upload Submission File” button in the dashed box at the bottom of the page and select the prediction file you wish to upload.
    英語のヒント
    ページ下部の破線の枠にある「Upload Submission File」ボタンをクリックし、アップロードしたい予測のファイルを選ぶ。
  • Click the “Make Submission” button at the bottom of the page to view your results.
    英語のヒント
    ページ下部の「Make Submission」ボタンをクリックして、結果を見る。
Image omitted because its reuse rights could not be verified.権利の確認ができないため画像を割愛。
Fig. 5.7.3図5.7.3
Submitting data to Kaggle
英語のヒント
Kaggleへのデータの提出