[scikit-learn] Equivalent to Cost Matrix sklearn

Nicolas Goix goix.nicolas at gmail.com
Sun Mar 18 08:26:16 EDT 2018


Hi Nadim,

you may also want to take a look at *skope-rules* (
https://github.com/scikit-learn-contrib/skope-rules), which has recently been
added to scikit-learn-contrib.

The main goal of this package is to provide logical rules verifying
precision and recall conditions, by extracting them from a fitted tree
ensemble and evaluating them out of bag.


Nicolas

On Fri, Mar 16, 2018 at 5:25 AM, Andreas Mueller <t3kcit at gmail.com> wrote:

> Hi.
>
> Unfortunately we don't have an implementation of a cost matrix in sklearn
> directly, but you can change the threshold of the model prediction,
> by using something like y_pred = tree.predict_proba(X_test)[:, 1] > 0.6
>
> What trade-off of precision and recall do you want? Have you looked at the
> precision_recall_curve?
>
> Andy
>
>
> On 03/15/2018 09:28 PM, Nadim Farhat wrote:
>
> Dear All,
>
> I have a *screening* lab test and I am trying to minimize the False
> negative value in the recall (TP/(TP+FN)) therefore I want to increase the
> cost whenever an FN is found in the training. I understand that in R they
> have some kind of loss matrix that penalize the FN during fitting.  my
> Postive classes percentage is 30 %
> On the forums and StackOverflow, they suggest using class_weight=balanced
> in the decision tree which oversamples the class with the lowest
> frequency. However, I don't see how that helps in minimizing the FN.
>
> Any suggestions?
>
>
> Bests
>
> Nadim
>
>
>
>
>
>
>
>
>
> --
> Nadim Farhat
>
>
> _______________________________________________
> scikit-learn mailing listscikit-learn at python.orghttps://mail.python.org/mailman/listinfo/scikit-learn
>
>
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20180318/d042471b/attachment.html>


More information about the scikit-learn mailing list