You could use the implementation of sample_weight support in
cross-validation from https://github.com/scikit-learn/scikit-learn/pull/1574,
which should work but doesn't have much in the way of tests. It may be
superseded by https://github.com/scikit-learn/scikit-learn/pull/3524


On 3 August 2014 14:05, Michael Anuzis <[email protected]> wrote:

> Greetings scikit-learn-general,
>
> Long time fan of scikit-learn, but my first post on this list. Appreciate
> any insight or guidance you can share.
>
> I'm trying to implement my own scoring function for cross_val_score using
> the make_scorer factory function. The evaluation I'm trying to build is for
> a normalized weighted gini, which requires a "weights" array passed in to
> calculate the relative weight of each row.
>
> The function works fine when called manually with (y_true, y_pred), but
> raises an AssertionError when called as a parameter on
> cross_val_score(scoring=gini_function)... I think the error might be due to
> the weights array being its original size, while the (y_true, y_pred)
> arrays might be reduced sizes for cross-validation folds.
>
> Here's my code and the stack trace:
>
>    - https://dpaste.de/Zk6n
>
> Appreciate any suggestions,
> -Michael
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to