[scikit-learn] baggingClassifier with pipeline

Roxana Danger roxana.danger at gmail.com
Fri Jun 28 16:17:41 EDT 2019


Hi Manuel,
thanks for your reply, before trying an alternative as PipeGraph, or
implementing the class as you propose, I would prefer to include some code
in the _fit method of BaggingClassifier, so the correct value of X can be
passed to the base_estimator (the dataframe or its array of values).
Many thanks in advance,
Roxna

On Fri, Jun 28, 2019 at 2:39 PM Manuel CASTEJÓN LIMAS via scikit-learn <
scikit-learn at python.org> wrote:

> You can always add a first step that turns you numpy array into a
> DataFrame such as the one required afterwards.
> A bit of object oriented programming might be required though, for
> deriving you class from BaseTransformer and writing you particular code for
> fit and transform method.
> Alternatively you can try the PipeGraph library for dealing with those
> complex routes.
> Best
> Manuel
> Disclaimer: yes, I'm a coauthour of the PipeGraph library.
>
> El vie., 28 jun. 2019 7:28, Roxana Danger <roxana.danger at gmail.com>
> escribió:
>
>> Hello,
>> I would like to use the BaggingClassifier whose base estimator is a
>> pipeline with multiple transformations including a DataFrameMapper from
>> sklearn_pandas.
>> I am getting an error during the fitting the DataFrameMapper as the first
>> step of the BaggingClassifier is to convert the DataFrame to an array (see
>> in BaseBagging._fit method). Similar problem happen using directly
>> sklearn.Pipeline instead of the DataFrameMapper. in both cases, a DataFrame
>> is expected as input, but, instead, an array is provided to the Pipeline.
>>
>> Is there anyway I can overcome this problem?
>>
>> Many thanks,
>> Roxana
>>
>> _______________________________________________
>> scikit-learn mailing list
>> scikit-learn at python.org
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20190628/e0b43902/attachment.html>


More information about the scikit-learn mailing list