python - How to give different weights to features while training a SGDClassifier in Scikit? -


from documentation,

class sklearn.linear_model.sgdclassifier(class_weight=none) 

like class_weight function, how give weights particular aspects of feature set? feature sets consists of raw text, , name. while training want give more weight name, , less weight raw text. how do that?

there no option give weights features in sgdclassifier, , far know in no other learner in scikit-learn.

in general, not make sense give different weights features. after all, machine learning because want computer figure out features more important. if name more important raw text classifier figure out internally.

now, if still want have different features different importance can combine multiple classifiers: train 1 classifier using name feature, , train classifier using raw text features. combine output taking weighted average of each classifier's output. can give name-classifier higher weight, increase name's impact on combined output.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -