## 3 Handling Our Dataset
### Building Features for ML models
#### 3.2.3 Introduction of New Features
The formula for calculating _league_weight_ is as follows:  
\[\textit{league\_weight}_{i}=w_{\text{hist}}\times\text{hist\_score}_{i}+w_{ \text{fan}}\times\text{fan\_score}_{i}, \tag{1}\]  
where the variable \(i\) stands for each league. The weight \(w_{\text{hist}}\) is assigned to historical information, while \(w_{\text{fan}}\) is assigned to fan attendance. Moreover, \(\text{hist\_score}\) represents the normalized historical score for each league, and \(\text{fan\_score}\) is the normalized fan attendance score for each league. According to our formula, _league_weight_ is calculated using two main factors: historical success and fan attendance. By including these two factors, we make sure the analysis considers both the competitive strength and the popularity of each league. A higher historical score shows strong international performance and a higher standard of competition, while a higher fan attendance score reflects more commercial appeal, financial resources, and the ability to attract top players. Each league's score can go up to a maximum of 10 points, with a perfect score indicating the highest levels of fan support and historical success. Using these weights helps us account for differences between leagues, allowing a more accurate representation of each league's true strength and unique features. This approach ensures fairer comparisons between players and teams from different leagues by considering differences in league quality and other key factors. Overall, this method provides more reliable and precise soccer analysis, ensuring our models give valid insights across various levels of competition. In addition, we introduce another feature called _position_weight_. Player position significantly affects a player's \(xG\) and \(aG\) as well as the overall impact on the game. Forwards, who focus on scoring goals, usually have higher xG compared to defenders. Meanwhile, goalkeepers and defenders have specific duties; goalkeepers concentrate on making saves, while defenders aim to stop the opposition from scoring [37]. Our dataset includes players whose primary positions are goalkeepers, defenders, midfielders, and strikers. Additionally, over the years, certain players have transitioned between various positions on the field. To accurately capture these shifts and their impact, we developed a feature that categorizes players into specific positional groups. We then assign weight to each category based on the players' anticipated contributions to scoring goals and influencing game outcomes. This approach allows us to account for positional versatility and better understand how players' roles evolve and affect their overall performance and team dynamics. For example, we grouped players into categories such as midfielder and striker, defensive striker, and forward, midfielder, and striker, among others. Each group received a weight based on its influence on \(xG\). Positions related to scoring goals, such as forward and striker, received higher ratios of 10, highlighting their key role in creating scoring chances. In contrast, positions with defensive or goalkeeping duties, such as defenders and goalkeepers received lower ratios of 4 and 0.1, respectively, reflecting their focus on preventing goals rather than scoring. Ratios for mixed roles, like defender, forward, and midfielder or forward and midfielder were adjusted to account for their diverse responsibilities across different aspects of the game. By incorporating _position_weight_, we adjust our analysis to account for the various responsibilities and expected outcomes of different player positions. This feature offers a more comprehensive understanding of player performance and potential across different roles on the field. It also enables more precise comparisons between players in similar positions, leading to deeper and more meaningful insights into the game.