How can i make sample submission file

i have created the model with accuracy 94. how can i test the result and make sample submission file for that.

Hi @raj77,

  1. Read the submission file
    submission=pd.read_csv("Sample_Submission_ZAuTl8O_FK3zQHh.csv")

  2. Set the loan ID and predictions
    submission['Loan_Status']=pred_test submission['Loan_ID']=test_original['Loan_ID']

  3. Remember we need predictions in Y and N. So convert 1 and 0 to Y and N.
    submission['Loan_Status'].replace(0, 'N',inplace=True)
    submission['Loan_Status'].replace(1, 'Y',inplace=True)

  4. Convert the submission to .csv format and make submission to check the accuracy on the leaderboard.
    pd.DataFrame(submission, columns=['Loan_ID','Loan_Status']).to_csv('logistic.csv')

Reference: Free Course: Loan Prediction Practice Problem

Hi, i get an error when creating submission csv,on the below line of code
submission[‘Loan_ID’]=test_original[‘Loan_ID’], i get “test_original” not defined

Hi @solly7, have you defined a dataframe ‘test_original’? please try and print the shape of the dataframe.

Hi, since im still new…what do i define test_original dataframe into?? please help

@solly7, test_original is nothing but the test dataset provided. You need to load the dataset using the following command -

 test_original = pd.read_csv('name_of_test_file')

Thanks a lot…let me try it out

Hi,
i have managed to replaced ‘test_original’ with my defined name for test dataset, but now im having a problem with below code
submission[‘Loan_ID’]=df_validation[‘Loan_ID’], i get an error KeyError: ‘Loan_ID’, i think is because i have droped loan id at the top. any idea of how to solve this?

@solly7, You can save the loan ID in the submission file before dropping the column.

Thanks a lot…it worked…i have succesfully submitted

© Copyright 2013-2019 Analytics Vidhya