Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行season one中的xgb.py出现问题 #10

Open
CXY573 opened this issue Jan 22, 2018 · 3 comments
Open

运行season one中的xgb.py出现问题 #10

CXY573 opened this issue Jan 22, 2018 · 3 comments

Comments

@CXY573
Copy link

CXY573 commented Jan 22, 2018

这是什么问题呢???
Traceback (most recent call last):
File "xgb.py", line 58, in
dataset3_preds.label = MinMaxScaler().fit_transform(dataset3_preds.label)#区间缩放到[0,1]
File "/home/cxy/anaconda3/lib/python3.6/site-packages/sklearn/base.py", line 518, in fit_transform
return self.fit(X, **fit_params).transform(X)
File "/home/cxy/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/data.py", line 308, in fit
return self.partial_fit(X, y)
File "/home/cxy/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/data.py", line 334, in partial_fit
estimator=self, dtype=FLOAT_DTYPES)
File "/home/cxy/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py", line 410, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[-0.21156955 0.33369869 -0.30134243 ..., 0.08833629 -0.15614033
0.31751922].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

@yab119074412
Copy link

在MinMaxScaler()那一行上面加一句:
dataset3_preds.label=np.array(dataset3_preds.label).reshape(-1,1)

@wuhaotju
Copy link

@yab119074412 还是不行啊

@zhuzhujulie
Copy link

我也遇到这个问题,请问解决了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants