Traceback (most recent call last): File "C:\Users\www12\Desktop\AdaBoost\adaboost.py", line 28, in <module> bdt.fit(X, y) File "E:\anaconda\lib\site-packages\sklearn\ensemble\_weight_boosting.py", line 126, in fit X, y = self._validate_data( File "E:\anaconda\lib\site-packages\sklearn\base.py", line 565, in _validate_data X, y = check_X_y(X, y, **check_params) File "E:\anaconda\lib\site-packages\sklearn\utils\validation.py", line 1106, in check_X_y X = check_array( File "E:\anaconda\lib\site-packages\sklearn\utils\validation.py", line 902, in check_array raise ValueError( ValueError: Expected 2D array, got 1D array instead: array=[0.045 0.049 0.05 ... 9. 1.2 9. ]. 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.
时间: 2023-09-02 10:15:23 浏览: 85
linux 下 pip3 报错“ File “/usr/bin/pip3”, line 9, in from pip import mainImportError: canno”处理
5星 · 资源好评率100%
这是一个 Python 错误追踪(traceback),它表明您的代码在执行期间遇到了一个异常错误。错误信息指出您的代码期望得到一个二维数组,但实际上得到的是一个一维数组。这可能是因为您的数据没有正确地被转换为二维数组,您可以尝试使用 `reshape` 方法将数据转换为二维数组,或者使用 `numpy` 的 `atleast_2d` 函数。
阅读全文