# Improving the model of base card value

/So while the previous model had a good fit, we can do better.

First, it's worth noting that we were training only off of creatures; weapons with no text were not modelled, and we were modelling those after the creatures.

By adding a categorical value for the card type, we can include both sets of data in the model, and provide a better prediction for both creatures and weapons.

Lastly, we add something to the model to account for card balance, penalizing cards that have are "lopsided" towards attack or health.

```
Deviance Residuals:
Min 1Q Median 3Q Max
-0.80723 -0.05861 0.03219 0.11557 0.88626
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.05952 0.45112 0.132 0.895
Attack 0.06746 1.17126 0.058 0.954
Health 0.81846 1.14619 0.714 0.475
sqrt(abs(Attack - Health)) -0.29185 0.98007 -0.298 0.766
CardType_q2 -2.39374 3.99784 -0.599 0.549
Attack:sqrt(abs(Attack - Health)) 0.25817 0.53455 0.483 0.629
Health:sqrt(abs(Attack - Health)) -0.18654 0.64174 -0.291 0.771
Attack:CardType_q2 0.07223 2.55269 0.028 0.977
Health:CardType_q2 0.98153 2.49477 0.393 0.694
sqrt(abs(Attack - Health)):CardType_q2 0.73281 2.73863 0.268 0.789
Attack:sqrt(abs(Attack - Health)):CardType_q2 0.46050 1.66056 0.277 0.782
Health:sqrt(abs(Attack - Health)):CardType_q2 -0.67290 1.20226 -0.560 0.576
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 59.0578 on 45 degrees of freedom
Residual deviance: 3.7054 on 34 degrees of freedom
AIC: 148.7
Number of Fisher Scoring iterations: 6
```

...and for a preview of just how much card mechanics beyond the Mana/Attack/Health relationship affect the true card cost, here's a plot of the predicted base vs actual for all minions and weapons.