Re: [Scikit-learn-general] Error faced in LinearRegression

2013-03-26 Thread Anne Dwyer
Or you could just say x.reshape(100,1) which is what I do. Anne Dwyer On Tue, Mar 26, 2013 at 9:44 AM, Lars Buitinck wrote: > 2013/3/26 abinash.panda.ece10 : > X = np.array([2*val for val in y]) > X.shape > > (100,) > > The correct input format is, per the documentation > > X : nu

Re: [Scikit-learn-general] Error faced in LinearRegression

2013-03-26 Thread Lars Buitinck
2013/3/26 abinash.panda.ece10 : X = np.array([2*val for val in y]) X.shape > (100,) The correct input format is, per the documentation X : numpy array or sparse matrix of shape [n_samples,n_features] So that's X = np.array([[2*val] for val in y]) or X = np.atleast2d(2 *

[Scikit-learn-general] Error faced in LinearRegression

2013-03-26 Thread abinash.panda.ece10
I have tried to fit some 1-D data using LinearRegression available in linear_model. Encountered a following error : >>> import numpy as np >>> y = np.arange(100) >>> X = np.array([2*val for val in y]) >>> clf = linear_model.LinearRegression() >>> clf.fit(X,y) Traceback (most recent call last):y F