2013/3/26 Abdul Wahid Memon <[email protected]>: > Hello all > > Is there any example of using datasets.load_svmlight_file() already > available or any data set in sparse matrix format to be used along > with this function in SCIKIT?
The API is pretty straightforward and documented here: http://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_svmlight_file.html X, y = load_svmlight_file(filepath) You can find sample datasets using the libsvm / svmlight format here: http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/ (only use classification datasets if you want to train classifiers) Then to compute the cross validated score of the linear SVM with C=1.0: from sklearn.cross_validation import cross_val_score from sklearn.svm import LinearSVC print(cross_val_score(LinearSVC(C=1.0), X, y, cv=3).mean()) -- Olivier http://twitter.com/ogrisel - http://github.com/ogrisel ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
