{
  "id": 77628,
  "title": "All predictions with same value!!!",
  "url": "/competitions/elo-merchant-category-recommendation/discussion/77628",
  "author_name": "",
  "post_date": "2019-01-15T03:34:43.150656600Z",
  "votes": 1,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Can someone help me with that?\nAs script bellow, my prediction test is returning with same target for all card_ids!!!! I made a test with  train prediction and it is ok! Any help I will really apreciate:</p>\n\n<p>1) Script:\nSel_Model = GBR\nNameM = 'GBR'</p>\n\n<h1>RunModel(NameM, Sel_Model, df_test_original, X_train, X_test, df_train_original['target'])</h1>\n\n<h1>def RunModel (ModelName, Model, Df_Test_Original, X_train, X_test, y):</h1>\n\n<p>print ('# # # # Prediction for Model:  ', NameM, '# # # #')\nprint ('Shape X_train: ', X_train.shape)\nprint ('Shape X_test: ', X_test.shape)\nprint ('Shape y: ', y.shape)\nprint ('Model: ', Sel_Model)\nSel_Model.fit(X_train, y)\nyhat_train = Sel_Model.predict(X_train)\nyhat_test = Sel_Model.predict(X_test)\nprint ('# # # # Prediction train:', yhat_train.shape, yhat_train)\nprint ('# # # # Prediction test:', yhat_test.shape, yhat_test)\nFilename = 'Output_' + NameM + '.csv'\ndf_Output= pd.DataFrame()\ndf_Output['card_id'] = df_test_original['card_id']\ndf_Output['target'] = yhat_test\ndf_Output.to_csv(Filename, index = False)</p>\n\n<p>2) Logs:</p>\n\n<h1># # # Prediction for Model:   GBR # # #</h1>\n\n<p>Shape X_train:  (201917, 9)\nShape X_test:  (123623, 9)\nShape y:  (201917,)\nModel:  GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,\n             learning_rate=0.1, loss='ls', max_depth=3, max_features=None,\n             max_leaf_nodes=None, min_impurity_decrease=0.0,\n             min_impurity_split=None, min_samples_leaf=1,\n             min_samples_split=2, min_weight_fraction_leaf=0.0,\n             n_estimators=100, n_iter_no_change=None, presort='auto',\n             random_state=None, subsample=1.0, tol=0.0001,\n             validation_fraction=0.1, verbose=0, warm_start=False)</p>\n\n<h1># # # Prediction train: (201917,) [-0.8204383   0.38480537  0.71745215 ...  0.11407518 -4.65064395</h1>\n\n<p>-1.81737442]</p>\n\n<h1># # # Prediction test: (123623,) [0.00194469 0.00194469 0.00194469 ... 0.00194469 0.00194469 0.00194469]</h1>",
  "messages": [
    {
      "id": "456060",
      "postDate": "01/15/2019 03:34:43",
      "content": "<p>Can someone help me with that?\nAs script bellow, my prediction test is returning with same target for all card_ids!!!! I made a test with  train prediction and it is ok! Any help I will really apreciate:</p>\n\n<p>1) Script:\nSel_Model = GBR\nNameM = 'GBR'</p>\n\n<h1>RunModel(NameM, Sel_Model, df_test_original, X_train, X_test, df_train_original['target'])</h1>\n\n<h1>def RunModel (ModelName, Model, Df_Test_Original, X_train, X_test, y):</h1>\n\n<p>print ('# # # # Prediction for Model:  ', NameM, '# # # #')\nprint ('Shape X_train: ', X_train.shape)\nprint ('Shape X_test: ', X_test.shape)\nprint ('Shape y: ', y.shape)\nprint ('Model: ', Sel_Model)\nSel_Model.fit(X_train, y)\nyhat_train = Sel_Model.predict(X_train)\nyhat_test = Sel_Model.predict(X_test)\nprint ('# # # # Prediction train:', yhat_train.shape, yhat_train)\nprint ('# # # # Prediction test:', yhat_test.shape, yhat_test)\nFilename = 'Output_' + NameM + '.csv'\ndf_Output= pd.DataFrame()\ndf_Output['card_id'] = df_test_original['card_id']\ndf_Output['target'] = yhat_test\ndf_Output.to_csv(Filename, index = False)</p>\n\n<p>2) Logs:</p>\n\n<h1># # # Prediction for Model:   GBR # # #</h1>\n\n<p>Shape X_train:  (201917, 9)\nShape X_test:  (123623, 9)\nShape y:  (201917,)\nModel:  GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,\n             learning_rate=0.1, loss='ls', max_depth=3, max_features=None,\n             max_leaf_nodes=None, min_impurity_decrease=0.0,\n             min_impurity_split=None, min_samples_leaf=1,\n             min_samples_split=2, min_weight_fraction_leaf=0.0,\n             n_estimators=100, n_iter_no_change=None, presort='auto',\n             random_state=None, subsample=1.0, tol=0.0001,\n             validation_fraction=0.1, verbose=0, warm_start=False)</p>\n\n<h1># # # Prediction train: (201917,) [-0.8204383   0.38480537  0.71745215 ...  0.11407518 -4.65064395</h1>\n\n<p>-1.81737442]</p>\n\n<h1># # # Prediction test: (123623,) [0.00194469 0.00194469 0.00194469 ... 0.00194469 0.00194469 0.00194469]</h1>",
      "rawMarkdown": "Can someone help me with that?\nAs script bellow, my prediction test is returning with same target for all card_ids!!!! I made a test with  train prediction and it is ok! Any help I will really apreciate:\n\n1) Script:\nSel_Model = GBR\nNameM = 'GBR'\n#RunModel(NameM, Sel_Model, df_test_original, X_train, X_test, df_train_original['target'])\n#def RunModel (ModelName, Model, Df_Test_Original, X_train, X_test, y):\n\nprint ('# # # # Prediction for Model:  ', NameM, '# # # #')\nprint ('Shape X_train: ', X_train.shape)\nprint ('Shape X_test: ', X_test.shape)\nprint ('Shape y: ', y.shape)\nprint ('Model: ', Sel_Model)\nSel_Model.fit(X_train, y)\nyhat_train = Sel_Model.predict(X_train)\nyhat_test = Sel_Model.predict(X_test)\nprint ('# # # # Prediction train:', yhat_train.shape, yhat_train)\nprint ('# # # # Prediction test:', yhat_test.shape, yhat_test)\nFilename = 'Output_' + NameM + '.csv'\ndf_Output= pd.DataFrame()\ndf_Output['card_id'] = df_test_original['card_id']\ndf_Output['target'] = yhat_test\ndf_Output.to_csv(Filename, index = False)\n\n2) Logs:\n# # # # Prediction for Model:   GBR # # # #\nShape X_train:  (201917, 9)\nShape X_test:  (123623, 9)\nShape y:  (201917,)\nModel:  GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,\n             learning_rate=0.1, loss='ls', max_depth=3, max_features=None,\n             max_leaf_nodes=None, min_impurity_decrease=0.0,\n             min_impurity_split=None, min_samples_leaf=1,\n             min_samples_split=2, min_weight_fraction_leaf=0.0,\n             n_estimators=100, n_iter_no_change=None, presort='auto',\n             random_state=None, subsample=1.0, tol=0.0001,\n             validation_fraction=0.1, verbose=0, warm_start=False)\n# # # # Prediction train: (201917,) [-0.8204383   0.38480537  0.71745215 ...  0.11407518 -4.65064395\n -1.81737442]\n# # # # Prediction test: (123623,) [0.00194469 0.00194469 0.00194469 ... 0.00194469 0.00194469 0.00194469]",
      "votes": null
    },
    {
      "id": "456809",
      "postDate": "01/16/2019 15:20:38",
      "content": "<p>I think I found what was wrong. I forgot the prediction field (target) in the Test Data Frame. I deleted it and now it worked. I believe Python should present some other error but ok. It is here for who got the same error! regards!!!</p>",
      "rawMarkdown": "I think I found what was wrong. I forgot the prediction field (target) in the Test Data Frame. I deleted it and now it worked. I believe Python should present some other error but ok. It is here for who got the same error! regards!!!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 456809,
      "author_name": "vicentegsantos",
      "author_url": "",
      "post_date": "01/16/2019 15:20:38",
      "content": "<p>I think I found what was wrong. I forgot the prediction field (target) in the Test Data Frame. I deleted it and now it worked. I believe Python should present some other error but ok. It is here for who got the same error! regards!!!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "456060": "Can someone help me with that?\nAs script bellow, my prediction test is returning with same target for all card_ids!!!! I made a test with  train prediction and it is ok! Any help I will really apreciate:\n\n1) Script:\nSel_Model = GBR\nNameM = 'GBR'\n#RunModel(NameM, Sel_Model, df_test_original, X_train, X_test, df_train_original['target'])\n#def RunModel (ModelName, Model, Df_Test_Original, X_train, X_test, y):\n\nprint ('# # # # Prediction for Model:  ', NameM, '# # # #')\nprint ('Shape X_train: ', X_train.shape)\nprint ('Shape X_test: ', X_test.shape)\nprint ('Shape y: ', y.shape)\nprint ('Model: ', Sel_Model)\nSel_Model.fit(X_train, y)\nyhat_train = Sel_Model.predict(X_train)\nyhat_test = Sel_Model.predict(X_test)\nprint ('# # # # Prediction train:', yhat_train.shape, yhat_train)\nprint ('# # # # Prediction test:', yhat_test.shape, yhat_test)\nFilename = 'Output_' + NameM + '.csv'\ndf_Output= pd.DataFrame()\ndf_Output['card_id'] = df_test_original['card_id']\ndf_Output['target'] = yhat_test\ndf_Output.to_csv(Filename, index = False)\n\n2) Logs:\n# # # # Prediction for Model:   GBR # # # #\nShape X_train:  (201917, 9)\nShape X_test:  (123623, 9)\nShape y:  (201917,)\nModel:  GradientBoostingRegressor(alpha=0.9, criterion='friedman_mse', init=None,\n             learning_rate=0.1, loss='ls', max_depth=3, max_features=None,\n             max_leaf_nodes=None, min_impurity_decrease=0.0,\n             min_impurity_split=None, min_samples_leaf=1,\n             min_samples_split=2, min_weight_fraction_leaf=0.0,\n             n_estimators=100, n_iter_no_change=None, presort='auto',\n             random_state=None, subsample=1.0, tol=0.0001,\n             validation_fraction=0.1, verbose=0, warm_start=False)\n# # # # Prediction train: (201917,) [-0.8204383   0.38480537  0.71745215 ...  0.11407518 -4.65064395\n -1.81737442]\n# # # # Prediction test: (123623,) [0.00194469 0.00194469 0.00194469 ... 0.00194469 0.00194469 0.00194469]",
    "456809": "I think I found what was wrong. I forgot the prediction field (target) in the Test Data Frame. I deleted it and now it worked. I believe Python should present some other error but ok. It is here for who got the same error! regards!!!"
  },
  "source": "meta"
}