Great. Thanks.

On Mon, Sep 21, 2015 at 8:16 PM, Andreas Mueller <t3k...@gmail.com> wrote:

> This is something I have wanted to fix for a while, and which I'll do
> after the release and after the model_selection refactoring is merged.
>
>
>
> On 09/20/2015 05:02 PM, Artem wrote:
>
> You can't get validation part of current CV split in estimator either way.
>
> On Sun, Sep 20, 2015 at 10:11 PM, okek padokek <defdefdef1...@gmail.com>
> wrote:
>
>> So you are suggesting to pass the validation set as a parameter to the
>> __init__() of the estimator? But how do I get the current validation set
>> from GridSearchCV? Using my above code, do you mean something like this:
>>
>> my_model = MY_MODEL()
>> pipe = Pipeline(steps=[("imputer", imputer), ("scaler", scaler),
>> ('my_model', my_model)])
>> my_params = dict(my_model__n_epochs = [10, 20], *my_model__validation_set
>> = [???]*)
>> estimator =
>> ​​
>> GridSearchCV(pipe, my_params, verbose=5, cv=5)
>> estimator.fit(x_train, y_train)
>>
>>
>> ?
>>
>> On Sun, Sep 20, 2015 at 10:10 AM, Artem < <barmaley....@gmail.com>
>> barmaley....@gmail.com> wrote:
>>
>>> Hi
>>>
>>> Don't pass any parameters to fit method. Current API assumes that you
>>> set all the parameters in estimator's constructor (__init__ method). It's a
>>> bit nasty to set validation set during construction stage, but there's no
>>> better approach.
>>>
>>> On Sun, Sep 20, 2015 at 3:47 PM, okek padokek <
>>> <defdefdef1...@gmail.com>defdefdef1...@gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> I am trying to implement my own estimator. It currently seems to be
>>>> working. My fit() function is of the form
>>>>
>>>> def fit(self, X, y=None):
>>>>     ....
>>>>     # iteratively tune the params
>>>>     ....
>>>>     return self
>>>>
>>>> I would like to modify my fit() so that it can print out validation
>>>> costs as it iterates:
>>>>
>>>> def fit(self, X, y=None, X_valid=None, y_valid=None):
>>>>     ....
>>>>     # iteratively tune the params
>>>>         #occasionally print out the cost on the validation set (X_test,
>>>> y_test)
>>>>     ....
>>>>     return self
>>>>
>>>> How would I go about passing the validation set when using a pipeline?
>>>>
>>>> I currently have something like this:
>>>>
>>>> my_model = MY_MODEL()
>>>> pipe = Pipeline(steps=[("imputer", imputer), ("scaler", scaler),
>>>> ('my_model', my_model)])
>>>> my_params = dict(my_model__n_epochs = [10, 20])
>>>> estimator = GridSearchCV(pipe, my_params, verbose=5, cv=5)
>>>> estimator.fit(x_train, y_train)
>>>>
>>>> If I instead try
>>>>
>>>> estimator.fit(x_train, y_train, x_valid, y_valid)
>>>>
>>>> then I get an error telling me that fit() does not accept the last two
>>>> parameters.
>>>>
>>>> How can this be done?
>>>>
>>>> Thanks
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> Scikit-learn-general mailing list
>>>> Scikit-learn-general@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Scikit-learn-general mailing list
>>> Scikit-learn-general@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Scikit-learn-general mailing list
>> Scikit-learn-general@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Scikit-learn-general mailing 
> listScikit-learn-general@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to