x_forecast = x[-forecast_out:]
x = x[:-forecast_out]
y = np.array(df['prediction'])
y = y[:-forecast_out]
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state = 0)
clf = LinearRegressio()
clf.fit(train_x, train_y)
s = clf.score(test_x, test_y)
print('score', s)
error:
ValueError Traceback (most recent call last)
<ipython-input-80-7476b5a54000> in <module>()
----> 1 x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state = 0)
2
3 clf = LinearRegressio()
4 clf.fit(train_x, train_y)
5
2 frames
/usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py in check_consistent_length(*arrays)
210 if len(uniques) > 1:
211 raise ValueError("Found input variables with inconsistent numbers of"
--> 212 " samples: %r" % [int(l) for l in lengths])
213
214
ValueError: Found input variables with inconsistent numbers of samples: [1417, 1477]