I haven't seen any patch for this precisely, though it's a known issue
(even if it doesn't seem to be explicitly ticketed; it's closest to
https://github.com/scikit-learn/scikit-learn/issues/1179). There are
various tricky cases not currently supported for which it's easiest to roll
your own search and/or pipeline infrastructures.

Part of the issue is that presumably (or perhaps not?) your search
objective function needs to adjust for weights as well as the training
procedure, and currently our metrics don't support that (work in progress
at https://github.com/scikit-learn/scikit-learn/pull/1574).

After that's in place there's still an API issue to apply this generally:
if `BaseSearchCV.fit` were modified to take extra arguments that needed to
be split in cross-validation, when are they passed to `fit` and when to
`score`? Perhaps that's not so hard if we're only considering
sample_weight. (And if Pipeline were modified to support sample_weight,
should it presume it to pass sample_weight to *all* its transformers? to
those accepting the parameter? to none but the last estimator?)

Cheers,

- Joel


On Sat, Jun 1, 2013 at 1:05 AM, Andreas Mueller <amuel...@ais.uni-bonn.de>wrote:

> Hi Peter.
> What you try to achieve is currently not possible afaik
> There was a branch by Noel to implement this but I'm not sure about it's
> state.
> You could give it a shot.
> Alternatively you can use the IterGrid (or ParameterGrid in the dev
> version I think)
> from the grid_search module and write the for-loop yourself.
> That shouldn't be too hard.
>
> Hth,
> Andy
>
> On 05/31/2013 04:25 PM, Peter Retzlaff wrote:
> > Hello everyone,
> >
> > I'm trying to execute a grid search with the GridSearchCV class (for an
> > AdaBoostClassifier) and want to use a custom sample_weight vector to
> > begin with. However, I can't figure out, how to do this. Passing the
> > parameter to GridSearchCV's fit()-method gives me the message, that this
> > is deprecated and will be ignored. Passing it to the
> > GridSearch-constructor like so:
> >
> > grid = GridSearchCV(clf, params, fit_params={'sample_weights':
> my_weights})
> >
> > doesn't work either, because it tries to apply the same weights vector
> > to each of the different folds, which of course doesn't make sense and
> > fails because the size of my_weights doesn't correspond to the sizes of
> > the folds. Can I somehow specify a weights vector for each fold? Is
> > there an easier way? Is this even possible?
> > I'm sorry, if I'm missing something obvious here.... By the way, I'm
> > using the latest development version (0.14-git).
> >
> > Best regards.
> > Peter
> >
> >
> >
> ------------------------------------------------------------------------------
> > Get 100% visibility into Java/.NET code with AppDynamics Lite
> > It's a free troubleshooting tool designed for production
> > Get down to code-level detail for bottlenecks, with <2% overhead.
> > Download for free and get started troubleshooting in minutes.
> > http://p.sf.net/sfu/appdyn_d2d_ap2
> > _______________________________________________
> > Scikit-learn-general mailing list
> > Scikit-learn-general@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite
> It's a free troubleshooting tool designed for production
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap2
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to