stability-selection icon indicating copy to clipboard operation
stability-selection copied to clipboard

The "n_resampling" parameter of RandomizedLogisticRegression and "scores_" of RandomizedLasso

Open Roych13 opened this issue 4 years ago • 0 comments

from sklearn.datasets import make_classification
from stability_selection import RandomizedLogisticRegression
from stability_selection import RandomizedLasso

selector = RandomizedLogisticRegression(n_resampling=300, random_state=101)
selector.fit(xTrain, yTrain)
print('the selected features:%i' % sum(selector.get_support() != 0))
xTrainS = selector.transform(xTrain)
xTestS = selector.transform(xTest)
classifier.fit(xTrainS, yTrain)
print('the scores:%0.3f' % classifier.score(xTestS, yTest))

x, y = make_classification(n_samples=100, n_features=10,
                           n_informative=4, random_state=101)
rLasso = RandomizedLasso()
rLasso.fit(x, y)
print(list(enumerate(rLasso.scores_)))
print(rLasso.get_support())

THE ERROR SHOWS AS BELOW:

Traceback (most recent call last):

File "", line 5, in selector = RandomizedLogisticRegression(n_resampling=300, random_state=101)

TypeError: init() got an unexpected keyword argument 'n_resampling'

AttributeError: 'RandomizedLasso' object has no attribute 'scores_'

'RandomizedLasso' object has no attribute 'get_support'

Could you tell me how to solve these problems?

Roych13 avatar Feb 08 '20 16:02 Roych13