0
$\begingroup$

I am trying to use sklearn Random forest to predict the probability of win/lose in a card game. There are 4 features in my data set. Feature $X_4$ is the hand strength of the player and y (the winning probability) is monotonically increasing in the hand strength. Thus I have a cutoff decision: for every combination of the first three features $(X_1,X_2,X_3)$ there is a Threshold $T$ such that, for $X_4 > T$, play Right, otherwise play Left.

The prediction isn't monotonic, that is, for some $(X_1,X_2,X_3, X_4=x')$ the predicted label is $1$ however for $(X_1,X_2,X_3, X_4=x'')$ where $x''>x'$ the predicted label is $0$.

How can I enforce this monotonicity?

Should I use a different classifier? is DecisionTreeClassifier better suit this problem? my data labels are unbalanced at 65:35

EDIT: logistic regression produces this monotonicity.

$\endgroup$
  • 1
    $\begingroup$ I’m not aware of a way to do this using sklearn unless you want to write the class yourself. However the xgboost library supports monotonicity in features. $\endgroup$ – Sycorax Dec 17 '18 at 15:36
  • 1
    $\begingroup$ You can use logistic regression, maybe representant $X_4$ with a (monotone) spline. $\endgroup$ – kjetil b halvorsen Dec 17 '18 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.