air7553
飞飞飞:)
2019-03-11 20:42

Expected 2D array, got 1D array instead: array=[1]

  • python

from sklearn import linear_model

lm=linear_model.LinearRegression()

features=['petallength']

x =iris[features]

y =iris['petalwidth']

print(x.shape,y.shape)

model=lm.fit(x,y)

print(model.intercept_,model.coef_)

model.predict([1])

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答