为什么会给我“预期的2D数组,取而代之的是1D数组”的错误,

问题描述 投票:0回答:1
Output as shown and thrown error我使用了regressor.fit([X_train],[Y_train]),它确实起作用,但是当我运行下面的代码时,它给了我以下错误“ ValueError:形状(1,9)和(21, 21)未对齐:9(暗淡1)!= 21(暗淡0)“

请帮助

machine-learning scikit-learn linear-regression
1个回答
0
投票
问题在于选择的索引和尺寸。将x更改为

X = dataset.iloc[:, :-1].values

© www.soinside.com 2019 - 2024. All rights reserved.