[scikit-learn] Random Forest without target to measure feature importance

Gabor Toth gabor.toth at maximilianeum.de
Tue Jul 23 12:25:55 EDT 2019


Hello,

I would like to use Random Forest classifier to assess the importance of
features (bag-of-words) but I don't have any predefined class labels or any
test data. I have earlier used ExtraTreesClassifier() with fit_transform,
which is not available anymore (see below). I am wondering how I could use
Random Forest now.

clf = ExtraTreesClassifier()

clf.fit_transform(doc_term_matrix,np.empty(doc_term_matrix.shape))
features_importance=np.array(clf.feature_importances_)

Thanks,

Gabor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20190723/3e97849c/attachment.html>


More information about the scikit-learn mailing list