Re: [Scikit-learn-general] Sample weighting in RandomizedSearchCV

2015-06-12 Thread José Guilherme Camargo de Souza
Hi Joel, Sorry for the late reply. That solved the problem. Thanks for the tip, I did not notice the parameter should be prefixed (which is kind of obvious). Thanks a lot, José José Guilherme On Tue, Jun 9, 2015 at 1:38 PM, Joel Nothman wrote: > Until sample_weight is directly supported in Pi

Re: [Scikit-learn-general] Sample weighting in RandomizedSearchCV

2015-06-09 Thread Joel Nothman
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é Guilh

Re: [Scikit-learn-general] Sample weighting in RandomizedSearchCV

2015-06-09 Thread José Guilherme Camargo de Souza
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. """ Traceback (most recent call last): Fi

Re: [Scikit-learn-general] Sample weighting in RandomizedSearchCV

2015-06-08 Thread Andy
Hi Jose. That should work. Can you provide the full traceback? Also can you provide weights.shape? Andy On 06/08/2015 08:49 PM, José Guilherme Camargo de Souza wrote: > Hi all, > > I am having a different issue when trying to use sample_weights with > RandomizedSearchCV: > > weights = np.array(ca

Re: [Scikit-learn-general] Sample weighting in RandomizedSearchCV

2015-06-08 Thread José Guilherme Camargo de Souza
Hi all, I am having a different issue when trying to use sample_weights with RandomizedSearchCV: weights = np.array(calculate_weighting(y_train)) search = RandomizedSearchCV(estimator, param_dist, n_iter=n_iter, scoring="accuracy", n_jobs=-1, iid=True, cv=

Re: [Scikit-learn-general] Sample weighting in RandomizedSearchCV

2014-07-08 Thread Hamed Zamani
Dear Joel, Yes. After updating the version of Scikit-learn to 0.15b2 the problem was solved. Thanks, Hamed On Tue, Jul 8, 2014 at 2:51 PM, Joel Nothman wrote: > This shouldn't be the case, though it's not altogether well-documented. > According to > https://github.com/scikit-learn/scikit-lea

Re: [Scikit-learn-general] Sample weighting in RandomizedSearchCV

2014-07-08 Thread Joel Nothman
This shouldn't be the case, though it's not altogether well-documented. According to https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/cross_validation.py#L1225, if the fit_params value has the same length as the samples, it should be similarly indexed. So this would be a bug ... if

Re: [Scikit-learn-general] Sample weighting in RandomizedSearchCV

2014-07-08 Thread Kyle Kastner
It looks like fit_params are passed wholesale to the classifier being fit - this means the sample weights will be a different size than the fold of (X, y) fed to the classifier (since the weights aren't getting KFolded...). Unfortunately I do not see a way to accomodate for this currently - sample_

[Scikit-learn-general] Sample weighting in RandomizedSearchCV

2014-07-08 Thread Hamed Zamani
Dear all, I am using Scikit-Learn library and I want to weight all training samples (according to unbalanced data). According to the tutorial and what I found in the web, I should use this method: search = RandomizedSearchCV(estimator, param_distributions, n_iter=args.iterations, scoring=mae_scor