Primary competition visual

Sasol Customer Retention Recruitment Competition

Helping South Africa
R10 000 ZAR
Challenge completed ~2 years ago
Prediction
Job Opportunity
253 joined
56 active
Starti
Oct 05, 23
Closei
Nov 26, 23
Reveali
Nov 26, 23
Missing ID entries
Help · 17 Oct 2023, 06:46 · 4

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)

Discussion 4 answers
User avatar
Satti_Tareq

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]

19 Oct 2023, 14:39
Upvotes 0

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)

User avatar
Satti_Tareq

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 = .........

29 Oct 2023, 07:25
Upvotes 0