# ML algorithm where variable importance depends upon other variables - specifying conditionality

I am designing an algorithm that can detect cheating in a game of chess.

I have a database of players who have been flagged by moderators as cheating, along with a number of game-level characteristics such as move times and move accuracy (as determined by a chess engine) for both black and white.

Let's specify a simple regression:

cheatflag ~ whiteMoveTime + blackMoveTime + whiteMoveAccuracy + blackMoveAccuracy


Let's say cheatflag is a factor-level variable that is 0 if no cheater, 1 if white is the cheater, 2 if black is the cheater.

The issue is that the predictive value of variables like whiteMoveTime and whiteMoveAccuracy depends crucially on who is doing the cheating. If white is cheating, those variables should have different coefficients than if black is doing the cheating. As far as I know, running most blackbox algorithms will derive coefficients that average across all the cases of cheating without understanding the hierarchical nature of the variables.

This problem has a Bayesian flavor with some kind of conditional assumption -- if black is cheating, then these variables matter; if white is cheating, these variables matter, and so on.

How can I deal with this issue?

• do you already have the distinct probabilites that player 'Black' will cheat (hence you want to calculate a posterior probability that the game is rigged, or similar); or do you want to find these probability values/distributions?
– knb
Nov 9 '17 at 12:36
• I don't have distinct probabilities that player "Black" will cheat. I have a dataframe that contains rows of individual games. Some of those games have been flagged for cheating. Others are standard non-cheat games. Among the games that have been flagged for cheating, white has cheated half the time, black has cheated the other half. The goal is to create a model that can simultaneously assess whether a game has a cheater and, if so, who is doing the cheating. The problem is what I described above -- the importance of particular sets of variables depends on who does the cheating. Nov 9 '17 at 15:33

## 1 Answer

A simple place to get started is logistic regression for white outcomes first and then for black outcomes. Set cheatflag to 0 if there's no cheating and 1 if white cheated, then run the regression. Do it again, but set cheatflag to 0 if there's no cheating and 1 if black cheated.

• That's the way I am currently dealing with the situation, but my intuition is that it throws out important information that a combined model could appreciate. Also, for computational purposes, would prefer not to have two separate models that would need to be run on every single game. Nov 8 '17 at 15:06
• Good point. There's multinomial logistic regression and other multinomial models. Nov 8 '17 at 16:04
• I'm aware of multinomial logits, but they have the problem described above. The coefficients on the variables are a function of the average case in the dataset (averaging across white and black cheating instances). What I need is essentially some kind of "if-statement" structure embedded in the model -- if white is cheating, variable coefficients will be different than if black is cheating. In any case, your idea is working fine for now. Nov 8 '17 at 16:09