kaz-Anova / StackNet

StackNet is a computational, scalable and analytical Meta modelling framework
MIT License
1.32k stars 344 forks source link

How to convert sklearn sparse matrix to libsvm format? #64

Closed NagabhushanS closed 6 years ago

NagabhushanS commented 6 years ago

I am doing text classification. For this I am vectorizing my test using CountVectorizer and TfidfTransformer. This returns a sparse matrix. Now to use it as input for stacknet, I need to convert it into libsvm format. Is there any library that does this? Also, if I write the libsvm sparse matrix to a file, will stacknet be able to process it as its input?

NagabhushanS commented 6 years ago

I found out that sklearn contains a function to save a scipy sparse matrix to a file. Check this http://scikit-learn.org/stable/modules/generated/sklearn.datasets.dump_svmlight_file.html