Hi Andy,
Thanks for the clarifications. 

To avoid any kind of issues, I am constructing a new pipeline for each 
experiment. 
But you are right, and in the future, I will avoid doing so. 


Thank you, 


-----Original Message-----
From: Andy [mailto:t3k...@gmail.com] 
Sent: Tuesday, February 17, 2015 7:08 PM
To: scikit-learn-general@lists.sourceforge.net
Subject: Re: [Scikit-learn-general] custom regressor keeps failing


On 02/17/2015 03:50 PM, Pagliari, Roberto wrote:
> I see. But in my case I have things like
>
> for i in xrange(0, num_experiments):
>     estimators =  # some pipeline
>    etc...
>
> so estimators should be "re-created" everytime.
What do you mean by re-created? And where? if you construct your pipeline for 
each experiment, they are clearly independent. But according to the sklearn API 
you don't need to. "fit" will always forget any previous model.
What happens inside GridSearchCV and cross_val_score is:

for train, test in cv:
     this_estimator = clone(estimator)
     this_estimator.set_params(**params)
     this_estimator.fit(....)

Here "clone" takes all the parameters given by "get_params" and creates a new 
object that has the same parameters.
What is the issue you are having?
Also, did you read through the developer documentation on how to roll your own 
estimator 
(http://scikit-learn.org/dev/developers/index.html#rolling-your-own-estimator)? 
If we don't explain this clearly there, we have to work on that.


>
> In any case, I recently changed my code and I am no longer using lists.
>
> With scalar numbers I think it is working and  I see the correct number all 
> the time and from both __init__ and fit().
What do you mean by "the correct number"?
>
> I'm not sure if sklearn is supposed to support lists as parameters. But for 
> now I'm no longer using lists .
Yes, it does.


------------------------------------------------------------------------------
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