I found a tabular data problem and used the notebook from lesson 4 as a template. After training my model and successfully making single predictions and predictions for 200K rows I have a hard time finding how to put it into a csv for submission to kaggle.
Data
df = pd.read_csv(path/'train.csv') # used for training/validation
df_test = pd.read_csv(path/'test.csv') # to produce submission file to kaggle
Single prediction
row = df_test.iloc[0]
learn.predict(row)
#yields (Category 0, tensor(0), tensor([0.9457, 0.0543]))
All predictions
test_data = (TabularList.from_df(df_test, path=path, cont_names=cont_names, procs=procs)
.split_none()
.label_const('target')
.databunch())
preds = learn.get_preds(test_data)
#yields
[tensor([[0.9893, 0.0107],
[0.6970, 0.3030],
[0.9530, 0.0470],
...,
[0.8930, 0.1070],
[0.9864, 0.0136],
[0.9965, 0.0035]]), tensor([0, 0, 0, ..., 0, 0, 0])]
The submission csv should have the form
ID_code target
test_0 0
test_1 0
test_2 1
test_3 0
...
What do I do from here?
Thank you!