scikit learn - n_classes order in LinearSVC.coef_ -


i'm working linearsvc classify text data 3 classes. input data tfidf scores per word. i'm interested in seeing "contribution" words make classification. first question can use coef_ this? documentation states:

coef_ : array, shape = [n_features] if n_classes == 2 else [n_classes, n_features]

so, i'm assuming "n_classes" corresponds each of 3 classes documents can classified, , n_features coefficient values tfidf features. assuming case, what's order of classes in coef_? how can match each row in array 1 of classes?

thanks,

nick

without digging source code, believe there 2 answers questions:

  1. the classes sorted. if have classes ['a', 'b', 'c'], class order ['c','a','b']. (this may odd, make list in python , .sort() it. that's order.)

  2. there undocumented class member, linearsvc().classes_, holds order used class (see this method documentation).


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -