Until sample_weight is directly supported in Pipeline, you need to prefix
`sample_weight` by the step name with '__'. So for Pipeline([('a', A()),
('b', B())] use fit_params={'a__sample_weight': sample_weight,
'b__sample_weight': sample_weight} or similar.

HTH

On 10 June 2015 at 03:57, José Guilherme Camargo de Souza <
jose.camargo.so...@gmail.com> wrote:

> Hi Andy,
>
> Thanks for your reply. The full traceback is below, weights.shape and
> the training data shape are:
>
> (773,)
> (773, 82)
>
> I weas using a ExtraTreeClassifier but the same thing happens with an
> SVC. It doesn't seem to be an estimator-specific issue.
>
> ...
> ...........................................................................
> /Users/jgcdesouza/anaconda/lib/python2.7/site-packages/sklearn/pipeline.pyc
> in _pre_transform(self=Pipeline(steps=[('standardscaler',
> StandardScale...one, shrinking=True, tol=0.001, verbose=False))]),
> X=array([[ 16.       ,  16.       ,   1.       , ....   1.       ,
>           4.       ,   4.       ]]), y=array([ 1.,  1.,  1.,  1.,  1.,
>  1.,  1.,  0.,  ...,  0.,
>         1.,  1.,  0.,  0.,  1.,  1.,  0.]),
> **fit_params={'sample_weight': array([ 0.54980595,  0.54980595,
> 0.54980595,  0...5,
>         0.54980595,  0.54980595,  0.45019405])})
>     111     # Estimator interface
>     112
>     113     def _pre_transform(self, X, y=None, **fit_params):
>     114         fit_params_steps = dict((step, {}) for step, _ in
> self.steps)
>     115         for pname, pval in six.iteritems(fit_params):
> --> 116             step, param = pname.split('__', 1)
>     117             fit_params_steps[step][param] = pval
>     118         Xt = X
>     119         for name, transform in self.steps[:-1]:
>     120             if hasattr(transform, "fit_transform"):
>
> ValueError: need more than 1 value to unpack
> ___________________________________________________________________________
>
> Process finished with exit code 1
> """
>
>
>
> José Guilherme
>
>
------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to