Find selected features by RandomizedLogisticRegression

1.2k views Asked by At

I'm doing binary classification on 300Ksamples and 19 features. I employed RandomizedLogisticRegression() in scikit for feature selection. I'd like to know how can I find which features are selected by RandomizedLogisticRegression().

1

There are 1 answers

1
AvidLearner On BEST ANSWER

You should use the get_support function:

from sklearn.datasets import load_iris
from sklearn.linear_model import RandomizedLogisticRegression

iris = load_iris()
X, y = iris.data, iris.target

clf = RandomizedLogisticRegression()
clf.fit(X,y)
print clf.get_support()

#prints [False  True  True  True]

Alternatively, you can get the indices of the support features:

print clf.get_support(indices=True)
#prints [1 2 3]