How did anyone manage to reshape the data to fit the submission format
don't know how u r gonna generate train/test, but stack() function in pandas should be useful
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)
Take note to use same variable name, sorry for typo. Choose one variable name either Labels or Label
thanks @kejiaq and @tichavona
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.
don't know how u r gonna generate train/test, but stack() function in pandas should be useful
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)
Take note to use same variable name, sorry for typo. Choose one variable name either Labels or Label
thanks @kejiaq and @tichavona
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.