I have successfully installed XGBoost using this guide:
https://dnc1994.com/2016/03/installing-xgboost-on-windows/
Operating System: Windows 7
Compiler: TDM-GCC-64
Package used: Python 2.7
xgboost
version used: xgboost-0.6-py2.7.egg
When I typed this code in Jupyter Notebook-
import xgboost as xgb
gbm = xgb.XGBClassifier(max_depth=3,n_estimators=200,learning_rate=0.5).fit(scaled_train,y_train)
AttributeError Traceback (most recent call last)
1 #XGBoost
2 import xgboost as xgb
----> 3 gbm = xgb.XGBClassifier(max_depth=3,n_estimators=200,learning_rate=0.5).fit(scaled_train,y_train)
C:\ProgramData\Anaconda2\libsite-packagesxgboost-0.6-py2.7.eggxgboost\sklearn.pyc in fit(self, X, y, sample_weight, eval_set, eval_metric, early_stopping_rounds, verbose)
495 else:
496 train_dmatrix = DMatrix(X, label=training_labels,
--> 497 missing=self.missing, nthread=self.n_jobs)
498
499 self._Booster = train(xgb_options, train_dmatrix, self.n_estimators,
C:\ProgramData\Anaconda2\libsite-packagesxgboost-0.6-py2.7.eggxgboost\core.pyc in __init__(self, data, label, missing, weight, silent, feature_names, feature_types, nthread)
270 self._init_from_csc(data)
271 elif isinstance(data, np.ndarray):
--> 272 self._init_from_npy2d(data, missing, nthread)
273 else:
274 try:
C:\ProgramData\Anaconda2\libsite-packagesxgboost-0.6-py2.7.eggxgboost\core.pyc in _init_from_npy2d(self, mat, missing, nthread)
349 ctypes.byref(self.handle)))
350 else:
--> 351 _check_call(_LIB.XGDMatrixCreateFromMat_omp(
352 data.ctypes.data_as(ctypes.POINTER(ctypes.c_float)),
353 c_bst_ulong(mat.shape[0]),
C:\ProgramData\Anaconda2\lib\ctypes__init__.pyc in __getattr__(self, name)
373 if name.startswith('__') and name.endswith('__'):
374 raise AttributeError(name)
--> 375 func = self.__getitem__(name)
376 setattr(self, name, func)
377 return func
C:\ProgramData\Anaconda2\lib\ctypes__init__.pyc in __getitem__(self, name_or_ordinal)
378
379 def __getitem__(self, name_or_ordinal):
--> 380 func = self._FuncPtr((name_or_ordinal, self))
381 if not isinstance(name_or_ordinal, (int, long)):
382 func.__name__ = name_or_ordinal
AttributeError: function 'XGDMatrixCreateFromMat_omp' not found
I have checked core.py file in xgboostpython-packagexgboost folder and c_api file in xgboost\src\c_api folder and these look to be fine.
I am not sure why this issue could be popping up. Please help
It seems there were issues with the installation. I removed the xgboost installation directory and reinstalled xgboost using conda install -c anaconda py-xgboost
This worked like magic and XGBoost is working for me. Cheers :)
Most helpful comment
It seems there were issues with the installation. I removed the xgboost installation directory and reinstalled xgboost using conda install -c anaconda py-xgboost
This worked like magic and XGBoost is working for me. Cheers :)