python - How to fit SGDRegressor with two numpy arrays? -


i'm trying learn sgdregressor. generate own data don't know how fit algorithm. 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 inconsistent numbers of samples: [ 1 1000]

i'm new python , machine learning. miss?

>>> np.random.randint(100, size=1000) 

will give 1 x 1000 array. features , target variables need in column. try

>>> x = x.reshape(1000,) 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -