Primary competition visual

Zimnat Insurance Recommendation Challenge

Helping Zimbabwe
$5 000 USD
Completed (over 5 years ago)
Prediction
Collaborative Filtering
1777 joined
612 active
Starti
Jul 01, 20
Closei
Sep 13, 20
Reveali
Sep 13, 20
SUBMISSION
Help · 1 Sep 2020, 09:17 · 5

How did anyone manage to reshape the data to fit the submission format

Discussion 5 answers

don't know how u r gonna generate train/test, but stack() function in pandas should be useful

1 Sep 2020, 09:32
Upvotes 0
User avatar
tichavona
Chinhoyi university of technology

Good day,

You can try this code snippet. I did it manually through looping. Hope it answers your question

SubFile = pd.read_csv('SampleSubmission.csv') #Reading submissionsample file

probs = model.predict(x_test) #predicting x_test in the normal shape 10000 rows

IDXPCODE = list(SubFile.iloc[:,0]) #Extracting product names from SubFile

Labels = []

for i in range(test.shape[0]):

for j in range(21):

Labels.append(probs[i][j])

len(Labels) #make sure len is 210000 records

Submission = pd.DataFrame(list(zip(IDXPCODE,Label)),columns = ['ID X PCODE', 'Label'])

Submission.head(42)

1 Sep 2020, 09:32
Upvotes 0
User avatar
tichavona
Chinhoyi university of technology

Take note to use same variable name, sorry for typo. Choose one variable name either Labels or Label

It also depends on the approach you take to solving the problem. You can melt the train and test features then generate the IDXPCODE column.

3 Sep 2020, 10:34
Upvotes 0