On 09/12/2014 06:20 PM, Pagliari, Roberto wrote:

I added

import sklearn.base.TransformerMixin

but it says no module named TransofrmerMixin

Because TransformerMixin is not a module but a class.
You have to do
from sklearn.base import TransformerMixin


*From:*Joel Nothman [mailto:[email protected]]
*Sent:* Thursday, September 11, 2014 9:37 PM
*To:* scikit-learn-general
*Subject:* Re: [Scikit-learn-general] binarizer with more levels

Good point. It should be straightforward in any case, something like:

class Quantizer(sklearn.base.TransformerMixin):

    def __init__(self, thresholds):

        self.thresholds = thresholds  # must be sorted

    def transform(X, y=None):

        return np.searchsorted(self.thresholds, X)

On 12 September 2014 11:20, Pagliari, Roberto <[email protected] <mailto:[email protected]>> wrote:

    In my case I would like to do it right after scaling, while doing
    grid search.

    This would be different to quantize the entire training set at the
    beginning.

    Thank you,

    *From:*Joel Nothman [mailto:[email protected]
    <mailto:[email protected]>]
    *Sent:* Thursday, September 11, 2014 9:00 PM


    *To:* scikit-learn-general
    *Subject:* Re: [Scikit-learn-general] binarizer with more levels

    If thresholds can be provided to the constructor then they are not
    estimated automatically from the training data. This is the sort
    of preprocessing you can and should do with pandas.

    On 12 September 2014 10:53, Pagliari, Roberto
    <[email protected] <mailto:[email protected]>> wrote:

        I’m getting errors about get_params_ missing etc…

        I guess I need to derive my own binarizer from some other
        classes. Is there a way to simplify the process?

        Essentially, what I need is the binarizer, with more levels
        (and thresholds provided to the constructors).

        Thank you

        *From:*Joel Nothman [mailto:[email protected]
        <mailto:[email protected]>]
        *Sent:* Thursday, September 11, 2014 5:05 PM
        *To:* scikit-learn-general
        *Subject:* Re: [Scikit-learn-general] binarizer with more levels

        For quantizing or binning? Not currently.

        On 12 September 2014 06:31, Pagliari, Roberto
        <[email protected] <mailto:[email protected]>> wrote:

            Is there something like the binarizer with more levels
            (thresholds provided with input)

            Thanks


            
------------------------------------------------------------------------------
            Want excitement?
            Manually upgrade your production database.
            When you want reliability, choose Perforce
            Perforce version control. Predictably reliable.
            
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
            _______________________________________________
            Scikit-learn-general mailing list
            [email protected]
            <mailto:[email protected]>
            https://lists.sourceforge.net/lists/listinfo/scikit-learn-general


        
------------------------------------------------------------------------------
        Want excitement?
        Manually upgrade your production database.
        When you want reliability, choose Perforce
        Perforce version control. Predictably reliable.
        
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
        _______________________________________________
        Scikit-learn-general mailing list
        [email protected]
        <mailto:[email protected]>
        https://lists.sourceforge.net/lists/listinfo/scikit-learn-general


    
------------------------------------------------------------------------------
    Want excitement?
    Manually upgrade your production database.
    When you want reliability, choose Perforce
    Perforce version control. Predictably reliable.
    http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
    _______________________________________________
    Scikit-learn-general mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/scikit-learn-general



------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk


_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to