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
File "<pyshell#59>", line 1, in <module>
clf.fit(X,y)
File "/usr/lib/pymodules/python2.7/sklearn/linear_model/base.py", line
165, in fit
self.fit_intercept, self.normalize, self.copy_X)
File "/usr/lib/pymodules/python2.7/sklearn/linear_model/base.py", line
95, in _center_data
X_std = np.ones(X.shape[1])
IndexError: tuple index out of range
>>> X.shape
(100,)
So instead of X_std = np.ones(X.shape[1]) we could use :
>>> try:
X_std = np.ones(X.shape[1])
except:
X_std = np.ones(1)
--
Best Regards,
Abinash Panda
-----------------------
B.Tech Part -III (2014)
Electronics Engineering
Indian Institute of Technology (BHU), Varanasi
+91-7408853478
skype id : panda.abinash
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general