6
$\begingroup$

Can anybody please explain the difference between sklearn.pipeline.make_pipline and imblearn.pipeline.make_pipline.

$\endgroup$

1 Answer 1

1
$\begingroup$

The imblearn package contains a lot of different samplers for easy over- or under-sampling of data. These samplers can not be placed in a standard sklearn pipeline.

To allow for using a pipeline with these samplers, the imblearn package also implements an extended pipeline. This pipeline is very similar to the sklearn one with the addition of allowing samplers.

If you want to include samplers in the pipeline, use the imblearn pipeline. Otherwise, use the sklearn one.


The code for the imblearn pipeline can be seen here and the sklearn pipeline code here. Note that make_pipeline is just a convenient method to create a new pipeline and the differnece here is actually with the pipelines themselves.

$\endgroup$
3
  • 1
    $\begingroup$ but why is a sampler not implemented using the fit/transform paradigm of sklearn? what's different about this? $\endgroup$ Dec 1, 2019 at 12:56
  • $\begingroup$ @ShihabShahriarKhan: Without any deeper investigation, it could be due to the different treatment of training and testing data (see e.g. github.com/EpistasisLab/tpot/issues/547#issuecomment-451115193) or due to the issue that data is added or removed in the sampler which the standard sklearn API maybe doesn't support (since there is no need to). $\endgroup$
    – Shaido
    Dec 1, 2019 at 13:45
  • $\begingroup$ In case someone wants to understand more about Samplers, I found this article useful: machinelearningmastery.com/… $\endgroup$
    – loadbox
    Sep 30, 2020 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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