Hi everyone, I am having trouble with submitting my results. I have used index = False but that has not worked. The following below is my code with how I evaluated and saved my predictions to the submission file. Your help will be grealty appreciated:
test_df = test[X.columns]
preds = model.predict(test_df)
sub = pd.DataFrame({'ID': test.ID, 'Target': preds})
sub.to_csv('LightgbmBayesianOptimizedSubmission.csv', index = False)
I had the same problem when using lightgbm which you are using as I see, make sure that the predictions are integers not floats, i.e [1, 0] not [1.0, 0.0], this was my problem as least.
preds = [int(i) for i in preds]
I tried using the preds = [int(i) for i in preds]. it still came up with missing ID entries. The following below is my code with the float to integer function:
XTest = test.drop('ID', axis=1)
y_preds = model.predict(XTest)
y_preds = [int(i) for i in y_preds]
sub = pd.DataFrame({'ID': test.ID, 'Target': y_preds})
sub.to_csv('LGBMClassifierSubmission.csv', index = False)
this is wierd, did you look up for the csv file in your local machine? sometimes due to an error in the preprocessing you have done somethings doesn't go as expected.
try using
test['Target']=preds
sub = .........