{"action":"closed","issue":{"url":"https://api.github.com/repos/numeristical/introspective/issues/7","repository_url":"https://api.github.com/repos/numeristical/introspective","labels_url":"https://api.github.com/repos/numeristical/introspective/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/numeristical/introspective/issues/7/comments","events_url":"https://api.github.com/repos/numeristical/introspective/issues/7/events","html_url":"https://github.com/numeristical/introspective/issues/7","id":186433462,"number":7,"title":"model_xray not working with XGBoost","user":{"login":"blucena","id":18557908,"avatar_url":"https://avatars.githubusercontent.com/u/18557908?v=3","gravatar_id":"","url":"https://api.github.com/users/blucena","html_url":"https://github.com/blucena","followers_url":"https://api.github.com/users/blucena/followers","following_url":"https://api.github.com/users/blucena/following{/other_user}","gists_url":"https://api.github.com/users/blucena/gists{/gist_id}","starred_url":"https://api.github.com/users/blucena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blucena/subscriptions","organizations_url":"https://api.github.com/users/blucena/orgs","repos_url":"https://api.github.com/users/blucena/repos","events_url":"https://api.github.com/users/blucena/events{/privacy}","received_events_url":"https://api.github.com/users/blucena/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-01T00:07:06Z","updated_at":"2016-11-12T20:47:33Z","closed_at":"2016-11-12T20:47:33Z","body":"XGBoost does not seem to like working with the pandas column names.  There seems to be some chatter about this on stack overflow.  Need to figure out if there is an easy way to fix this.\r\n\r\n`results = mli.insights.model_xray(xgb1, X_test.sample(1000))`\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-54-23ed6ba5f17e> in <module>()\r\n----> 1 results = mli.insights.model_xray(xgb1, X_test.sample(1000))\r\n      2 \r\n\r\n/Users/lucenator/Work/Git/numeristical/introspective/ml_insights/insights.py in model_xray(model, data, columns, resolution, normalize_loc, **kwargs)\r\n     74         ## Generate predictions\r\n     75         for row_idx,row in enumerate(data):\r\n---> 76             y_pred = gen_model_pred(model, row, column_num, col_values)\r\n     77             if normalize_loc=='start':\r\n     78                 y_pred = y_pred - y_pred[0]\r\n\r\n/Users/lucenator/Work/Git/numeristical/introspective/ml_insights/insights.py in gen_model_pred(model, row, col_idx, values)\r\n     11         rows.append(sim_row)\r\n     12     if is_classifier(model):\r\n---> 13         y_pred = model.predict_proba(rows)[:,1]\r\n     14     else:\r\n     15         y_pred = model.predict(rows)\r\n\r\n/Applications/anaconda/envs/py3env/lib/python3.5/site-packages/xgboost-0.6-py3.5.egg/xgboost/sklearn.py in predict_proba(self, data, output_margin, ntree_limit)\r\n    475         class_probs = self.booster().predict(test_dmatrix,\r\n    476                                              output_margin=output_margin,\r\n--> 477                                              ntree_limit=ntree_limit)\r\n    478         if self.objective == \"multi:softprob\":\r\n    479             return class_probs\r\n\r\n/Applications/anaconda/envs/py3env/lib/python3.5/site-packages/xgboost-0.6-py3.5.egg/xgboost/core.py in predict(self, data, output_margin, ntree_limit, pred_leaf)\r\n    950             option_mask |= 0x02\r\n    951 \r\n--> 952         self._validate_features(data)\r\n    953 \r\n    954         length = ctypes.c_ulong()\r\n\r\n/Applications/anaconda/envs/py3env/lib/python3.5/site-packages/xgboost-0.6-py3.5.egg/xgboost/core.py in _validate_features(self, data)\r\n   1190 \r\n   1191                 raise ValueError(msg.format(self.feature_names,\r\n-> 1192                                             data.feature_names))\r\n   1193 \r\n   1194     def get_split_value_histogram(self, feature, fmap='', bins=None, as_pandas=True):\r\n\r\nValueError: feature_names mismatch: ['aniongap_min', 'aniongap_max', 'albumin_min', 'albumin_max', 'bicarbonate_min', 'bicarbonate_max', 'bilirubin_min', 'bilirubin_max', 'creatinine_min', 'creatinine_max', 'chloride_min', 'chloride_max', 'glucose_min', 'glucose_max', 'hematocrit_min', 'hematocrit_max', 'hemoglobin_min', 'hemoglobin_max', 'lactate_min', 'lactate_max', 'platelet_min', 'platelet_max', 'potassium_min', 'potassium_max', 'ptt_min', 'ptt_max', 'inr_min', 'inr_max', 'pt_min', 'pt_max', 'sodium_min', 'sodium_max', 'bun_min', 'bun_max', 'wbc_min', 'wbc_max'] ['f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24', 'f25', 'f26', 'f27', 'f28', 'f29', 'f30', 'f31', 'f32', 'f33', 'f34', 'f35']\r\nexpected glucose_max, potassium_min, ptt_min, bilirubin_min, creatinine_min, lactate_max, inr_min, albumin_min, aniongap_min, chloride_max, hematocrit_min, sodium_min, albumin_max, aniongap_max, hematocrit_max, sodium_max, wbc_max, creatinine_max, ptt_max, inr_max, bicarbonate_max, potassium_max, pt_min, pt_max, platelet_min, bun_min, bilirubin_max, glucose_min, bicarbonate_min, hemoglobin_min, platelet_max, wbc_min, bun_max, lactate_min, chloride_min, hemoglobin_max in input data\r\ntraining data did not have the following fields: f32, f13, f17, f8, f4, f24, f6, f9, f33, f2, f30, f18, f1, f20, f10, f34, f22, f15, f5, f23, f29, f11, f7, f25, f0, f16, f26, f19, f27, f31, f21, f35, f28, f14, f3, f12`\r\n```"}}
{"actor":{"display_login":"blucena"}}