Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

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

@Roych13

Description

@Roych13
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions