나는 scickit-learn API를 사용하여 파이썬에서 xgboost 회귀 모델을 만들고 가중치 열을 지정하려고합니다. 여기에 최소한의 코드 예입니다sampleweight가 XGBregressor에서 인식되지 않습니다.
from xgboost import XGBRegressor
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
model = XGBRegressor()
model.fit(df[['A','B']],df['D'],sample_weight=df['C'])
내가 할 때, 나는 다음과 같은 출력 얻을 :
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-12-2d43e3c01bbb> in <module>()
6
7
----> 8 model.fit(df[['A','B']],df['D'],sample_weight=df['C'])
TypeError: fit() got an unexpected keyword argument 'sample_weight'
지금까지 내가 말할 수있는 구문이 문서에 따르면, 올
: https://xgboost.readthedocs.io/en/latest/python/python_api.html#module-xgboost.sklearn를
다른 사람은 몇 시간 전 XGBoost 개발자들에게이 문제를보고하고, 고정 된 것으로 나타납니다, 그래서이 여전히 일어나고있는 이유를 잘 모르겠어요 :
https://github.com/dmlc/xgboost/pull/1874
이 문제를 해결하는 xgboost 버전을 어떻게 설치할 수 있습니까? 나는 Ubuntu 64-bit에서 Jupyter Notebook과 Anaconda와 함께 일하고 있습니다. 아나콘다없이이 작업을 수행해야합니까?