2013/7/12 Hakan <pekme...@rhrk.uni-kl.de>: > Unfortunately it's not pretty straight forward as you > said...
The error message was: TypeError: sparse matrix length is ambiguous; use getnnz() or shape[0] It is completely straightforward. It says that the object you are dealing with a sparse matrix as written in the documentation: http://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_svmlight_file.html Hence examples that use numpy arrays cannot be copied and pasted blindly. > I have made the changes Mathieu and you mentioned > but loading the feature set into an array "X=X.toarray()" > doesn't respond immediately to run any example with libsvm > datasets. > Please have a look the following code...decision boundry > line is complaining about shape: > File "linsvm.py", line 68, in <module> > Z = Z.reshape(XX.shape)#"total size of new array must > be unchanged"error > ValueError: total size of new array must be unchanged Well that is a completely unrelated error not caused by the libsvm/svmlight format. I don't really know how numpy.mgrid works, you should read the documentation to understand what wrong: http://docs.scipy.org/doc/numpy/reference/generated/numpy.mgrid.html Also print the shape the shape of Z, XX X both in the original example and in your modified script so as to understand what's going on. -- Olivier http://twitter.com/ogrisel - http://github.com/ogrisel ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Scikit-learn-general mailing list Scikit-learn-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/scikit-learn-general