Reputation: 12141
I'm trying to learn SGDRegressor
. I generate my own data but I don't know how to fit that into the algorithm. I get this error.
x = np.random.randint(100, size=1000)
y = x * 0.10
clf = linear_model.SGDRegressor()
clf.fit(x, y, coef_init=0, intercept_init=0)
Found arrays with inconsistent numbers of samples: [ 1 1000]
I'm new to python and Machine Learning. What do I miss?
Upvotes: 0
Views: 112
Reputation: 17593
>>> np.random.randint(100, size=1000)
will give you a 1 x 1000 array. Your features and target variables need to be in a column. Try
>>> x = x.reshape(1000,)
Upvotes: 1