Fitting More Complex XG Models
\[ \textrm{MISS} = n^{-1}\sum_{i = 1}^{n}{\mathbb{I}(y_{i} \neq \mathbb{I}(\hat{p}_{i} \geq 0.5))}, \]
\[ \textrm{LogLoss} = -1 \times n^{-1}\sum_{i = 1}^{n}{\left[ y_{i} \times \log(\hat{p}_{i}) + (1 - y_{i})\times\log(1-\hat{p}_{i})\right]}. \]
Problem: we don’t have access to a second dataset
Solution: create random training/testing split
for() loop:
DistToGoal?Binary outcome \(Y\) and numerical predictors \(X_{1}, \ldots, X_{p}\): \[ \log\left(\frac{\mathbb{P}(Y= 1 \vert \boldsymbol{\mathbf{X}})}{\mathbb{P}(Y = 0 \vert \boldsymbol{\mathbf{X}})}\right) = \beta_{0} + \beta_{1}X_{1} + \cdots + \beta_{p}X_{p}. \]
Keeping all other predictors constant, a one unit change in \(X_{j}\) associated with a \(\beta_{j}\) change in the log-odds
Say \(\beta_{j} = 1\). Increasing \(X_{j}\) by 1 unit moves \(\mathbb{P}(Y = 1)\)
Body part is a categorical predictor
Convert to factor type and one-hot encode
\[ \beta_{0} + \beta_{1}\times \textrm{DistToGoal} + \\ \beta_{\textrm{LeftFoot}}\times \mathbb{I}(\textrm{LeftFoot}) + \beta_{\textrm{RightFoot}} \times \mathbb{I}(\textrm{RightFoot}) \]
Different predictions based on the body part used to attempt the shot
For a shot taken at distance \(d\):
[1] "shot.type.name" "shot.technique.name" "shot.body_part.name"
[4] "DistToGoal" "DistToKeeper" "AngleToGoal"
[7] "AngleToKeeper" "AngleDeviation" "avevelocity"
[10] "density" "density.incone" "distance.ToD1"
[13] "distance.ToD2" "AttackersBehindBall" "DefendersBehindBall"
[16] "DefendersInCone" "InCone.GK" "DefArea"
glm()