---
# System prepended metadata

title: 2 Step Imitation

---

# 2 Step Imitation 
Unlike the paper we introduced previously, we consider that the single movement of a player can be split into picking and moving 2 steps. We split the prediction to 2 steps, picking and moving.We try this more human-like process with 2 models, one for picking and one for moving. Picking model first make a prediction according to the chess board, then pass it to moving model to predict the possible movement. Finally, we trim those ilegal movement and select the choice with highest confidence score.

## Work Flow
```graphviz
Digraph G{
"Chess Board"->"Pick Prediction"->"Move Prediction"->"trick"->"movement"
}
```
The trick above is doing some selection and operation in order to make a correct movement.

## Performance
To evaluate the model performance, we use top n accuracy for picking model and moving model. We define accurate as the answer of a set of data is included in model's prediction. 
### Top n accuracy
When the prediction has predicted, we sort it by confidence score. If the answer is in top n, then we defined it as correct. For example, the answer is at top 3, so it is correct for top 3 accuracy and top $n>=3$ accuracy, but incorrect for top $n<3$ accuracy
![](https://i.imgur.com/rWHM0ro.png)

## Loss Function
Our self-defined loss function : 
`Loss` = `rank of the answer` * `confidence score of answer position`
if `rank of the answer` <= 3 : `Loss` = 0
