前提・実現したいこと
ここに質問の内容を詳しく書いてください。
iMac(M1)でPythonでXGBoostingを実装中に以下のエラーメッセージが発生しました。
「import xgboost as xgb」まではうまくいきましたが、その後の対応がどうにも分かりません。
よろしくお願いします。
発生している問題・エラーメッセージ
-------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-87-d768f88d541e> in <module> ----> 1 model.fit(X_train, y_train) ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/core.py in inner_f(*args, **kwargs) 496 for k, arg in zip(sig.parameters, args): 497 kwargs[k] = arg --> 498 return f(**kwargs) 499 500 return inner_f ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/sklearn.py in fit(self, X, y, sample_weight, base_margin, eval_set, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, base_margin_eval_set, feature_weights, callbacks) 764 eval_qid=None, 765 create_dmatrix=lambda **kwargs: DMatrix(nthread=self.n_jobs, **kwargs), --> 766 enable_categorical=self.enable_categorical, 767 ) 768 params = self.get_xgb_params() ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/sklearn.py in _wrap_evaluation_matrices(missing, X, y, group, qid, sample_weight, base_margin, feature_weights, eval_set, sample_weight_eval_set, base_margin_eval_set, eval_group, eval_qid, create_dmatrix, enable_categorical, label_transform) 286 feature_weights=feature_weights, 287 missing=missing, --> 288 enable_categorical=enable_categorical, 289 ) 290 ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/sklearn.py in <lambda>(**kwargs) 763 eval_group=None, 764 eval_qid=None, --> 765 create_dmatrix=lambda **kwargs: DMatrix(nthread=self.n_jobs, **kwargs), 766 enable_categorical=self.enable_categorical, 767 ) ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/core.py in inner_f(*args, **kwargs) 496 for k, arg in zip(sig.parameters, args): 497 kwargs[k] = arg --> 498 return f(**kwargs) 499 500 return inner_f ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/core.py in __init__(self, data, label, weight, base_margin, missing, silent, feature_names, feature_types, nthread, group, qid, label_lower_bound, label_upper_bound, feature_weights, enable_categorical) 610 feature_names=feature_names, 611 feature_types=feature_types, --> 612 enable_categorical=enable_categorical, 613 ) 614 assert handle is not None ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/data.py in dispatch_data_backend(data, missing, threads, feature_names, feature_types, enable_categorical) 593 if _is_pandas_df(data): 594 return _from_pandas_df(data, enable_categorical, missing, threads, --> 595 feature_names, feature_types) 596 if _is_pandas_series(data): 597 return _from_pandas_series(data, missing, threads, feature_names, ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/data.py in _from_pandas_df(data, enable_categorical, missing, nthread, feature_names, feature_types) 259 data, enable_categorical, feature_names, feature_types) 260 return _from_numpy_array(data, missing, nthread, feature_names, --> 261 feature_types) 262 263 ~/opt/anaconda3/lib/python3.7/site-packages/xgboost/data.py in _from_numpy_array(data, missing, nthread, feature_names, feature_types) 159 config = bytes(json.dumps(args), "utf-8") 160 _check_call( --> 161 _LIB.XGDMatrixCreateFromDense( 162 _array_interface(data), 163 config, ~/opt/anaconda3/lib/python3.7/ctypes/__init__.py in __getattr__(self, name) 375 if name.startswith('__') and name.endswith('__'): 376 raise AttributeError(name) --> 377 func = self.__getitem__(name) 378 setattr(self, name, func) 379 return func ~/opt/anaconda3/lib/python3.7/ctypes/__init__.py in __getitem__(self, name_or_ordinal) 380 381 def __getitem__(self, name_or_ordinal): --> 382 func = self._FuncPtr((name_or_ordinal, self)) 383 if not isinstance(name_or_ordinal, int): 384 func.__name__ = name_or_ordinal AttributeError: dlsym(0x7fc15c75f500, XGDMatrixCreateFromDense): symbol not found
該当のソースコード
Python
1model = xgb.XGBRegressor() 2import xgboost as xgb 3(X_train, X_test, y_train, y_test) = train_test_split(x, y, test_size = 0.3, random_state = 666) 4model.fit(X_train, y_train) 5dtrain = xgb.DMatrix(X_train, label = y_train)
試したこと
以下の二つをそれぞれ実行っしてもエラーが出る。
model.fit(X_train, y_train)
dtrain = xgb.DMatrix(X_train, label = y_train)
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
あなたの回答
tips
プレビュー