Skip to content

Instantly share code, notes, and snippets.

@ybenjo
Last active July 27, 2017 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ybenjo/4d7a37262fb46c64a26eecef579004ba to your computer and use it in GitHub Desktop.
Save ybenjo/4d7a37262fb46c64a26eecef579004ba to your computer and use it in GitHub Desktop.
xgboost bug (Classifier can't handle nested array)
from xgboost import XGBClassifier
model = XGBClassifier(seed = 1)
# XOR Pattern
train_data = [
[1, 0],
[0, 1],
[1, 1],
[0, 0],
]
train_y = [1, 1, 0, 0]
model.fit(train_data, train_y)
# File "$HOME/.pyenv/versions/3.4.5/lib/python3.4/site-packages/xgboost/sklearn.py", line 432, in fit
# self._features_count = X.shape[1]
# AttributeError: 'list' object has no attribute 'shape'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment