Can I conclude that you are looking to implement a transformer? Note that
scikit learn transformers only act on X data, not on y data at the moment.
If this is what you need, then you need to implement a transform method for
your class. fit will still be necessary though, as the pipeline calls it
always.

HTH,
Michael

On Mon, Feb 16, 2015 at 4:20 PM, Pagliari, Roberto <rpagli...@appcomsci.com>
wrote:

> Broadly speaking, I would like to add my own custom function into a
> pipeline.
> However, my function is not really a classifier, nor a regressor.
> What do you think would be the best way to go about it? Is there a
> shortcut that does not require implementing the functions below?
>
>
> Thank you,
>
>
> -----Original Message-----
> From: Gael Varoquaux [mailto:gael.varoqu...@normalesup.org]
> Sent: Monday, February 16, 2015 12:56 AM
> To: scikit-learn-general@lists.sourceforge.net
> Subject: Re: [Scikit-learn-general] which methods do I need to implement
> for a regressor?
>
> You need fit, predict, and set_params. But set_params you can get by
> inheriting sklearn.base.BaseEstimator
>
> G
>
> On Mon, Feb 16, 2015 at 05:50:24AM +0000, Pagliari, Roberto wrote:
> > I'd like to implement my own regressor/classificator and possibly use
> > it in a pipeline.
>
> > do I need to implement all methods below or can some of them be missing?
>
> >
> ┌───────────────────────────────────┬─────────────────────────────────────────┐
> > │decision_function(X)               │Predict using the linear model
>      │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │densify()                          │Convert coefficient matrix to dense
> array│
> > │                                   │format.
>       │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │fit(X, y                           │Fit linear model with Stochastic
> Gradient│
> > │[, coef_init, intercept_init, ...])│Descent.
>      │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │fit_transform(X[, y])              │Fit to data, then transform it.
>       │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │get_params([deep])                 │Get parameters for this estimator.
>      │
> > ├───────────────────────────────────┼─────────────────────────────────
> > ────────┤ │partial_fit(X, y[, sample_weight]) │Fit linear model with
> > Stochastic Gradient│
> > │                                   │Descent.
>      │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │predict(X)                         │Predict using the linear model
>      │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │score(X, y[, sample_weight])       │Returns the coefficient of
> determination │
> > │                                   │R^2 of the prediction.
>      │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │set_params(*args, **kwargs)        │
>      │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │sparsify()                         │Convert coefficient matrix to
> sparse     │
> > │                                   │format.
>       │
> >
> ├───────────────────────────────────┼─────────────────────────────────────────┤
> > │transform(X[, threshold])          │Reduce X to its most important
> features. │
> > └───────────────────────────────────┴─────────────────────────────────
> > ────────┘
>
> > ----------------------------------------------------------------------
> > -------- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT
> > Server from Actuate! Instantly Supercharge Your Business Reports and
> > Dashboards with Interactivity, Sharing, Native Excel Exports, App
> > Integration & more Get technology previously reserved for
> > billion-dollar corporations, FREE
> > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.
> > clktrk
>
> > _______________________________________________
> > Scikit-learn-general mailing list
> > Scikit-learn-general@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
> --
>     Gael Varoquaux
>     Researcher, INRIA Parietal
>     Laboratoire de Neuro-Imagerie Assistee par Ordinateur
>     NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France
>     Phone:  ++ 33-1-69-08-79-68
>     http://gael-varoquaux.info            http://twitter.com/GaelVaroquaux
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from
> Actuate! Instantly Supercharge Your Business Reports and Dashboards with
> Interactivity, Sharing, Native Excel Exports, App Integration & more Get
> technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to