Skip to content

BackwardStepwiseOLS as Intermediary Pipeline Step #2

@dennislabajo

Description

@dennislabajo

Hello,

Can you please advise how I could incorporate BackwardStepwiseOLS into a pipeline as an intermediary step to a classifier and then doing RandomizedSearchCV? What I'm hoping to do is retrofit BackwardStepwiseOLS so it only returns the features of X whose p-value is within a configurable value of .05. Using other techniques e.g. PCA, LDA, or KPCA works as an intermediary step but I'm just curious how a model performs if the dimensions were reduced instead by a function such BackwardStepwiseOLS.

Here's a snippet of what I'm trying to do:

steps=[
	('preprocessor', preprocessor), 
        ('stepwise_ols',  BackwardStepwiseOLS(fK=10)), 
        ('classifier', RandomForestClassifier())]

pipeline = Pipeline(steps=steps)

rs = RandomizedSearchCV(estimator=pipeline, param_distributions=my_hyper_parameter,
    scoring='accuracy', return_train_score=True)

rs.fit(X, y)

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions