0
$\begingroup$

So I am currently working on a Data set, and I want to use Pipelines to select the transforms. Here is an example of what I want to do :

# I missed the imports just for brevity
pipeline = make_pipeline(StandardScaler(), PolynomialFeatures(), PCA(), LogisticRegression())

So what I want to do, I want to try both StandardScaler, MinMaxScaler and no scaler when I am using other methods such as XGBOOST. Then I want to try to use polynomial features and then use a PCA, only if I used polynomial features. And finally, I want to try Logistic Regression and XGBOOST with GridSearch (This last part I know how to do).

Anybody did something similar? Thank you!

$\endgroup$
1
$\begingroup$

The purpose of the pipeline is to assemble several steps that can be cross-validated together while setting different parameters. For this, it enables setting parameters of the various steps using their names

Check the docs

For your requirement, you will have to create multiple pipelines, you cannot do it via single pipeline.

$\endgroup$
1
  • $\begingroup$ Yeah I am aware of what the documentation says. I was wondering if someone had an elegant solution for this anyway. $\endgroup$ Aug 21 '20 at 11:12
0
$\begingroup$

There is an example of this here:

https://iaml.it/blog/optimizing-sklearn-pipelines

$\endgroup$
2
  • $\begingroup$ How do you make it to accept your own answers as the accepted one? $\endgroup$ Sep 2 '20 at 21:10
  • $\begingroup$ I just clicked on the tick on the left why? $\endgroup$ Sep 2 '20 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.