Primary competition visual

Zimnat Insurance Recommendation Challenge

Helping Zimbabwe
$5 000 USD
Completed (~6 years ago)
Prediction
Collaborative Filtering
1791 joined
612 active
Starti
01 Jul 20
Closei
13 Sep 20
Reveali
13 Sep 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
User avatar

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

Upvotes 0
User avatar
tichavona

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)

Upvotes 0
User avatar
tichavona

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

Upvotes 0
User avatar

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.

Upvotes 0