Fencing Model Development and Web Deployment Report

: Fencing has been an interesting sport for decades. Modern fencing is a sport that tests a competitor's skills, reflexes, and mental fortitude, among other abilities. In this work, an analytical model to predict a player’s proficiency in fencing is proposed. A player’s proficiency score is linearly dependent on the player’s arm length, leg length, agility, speed and reaction speed. To realized the model, at least 6 players’ data must be collected. When there are more than 6 players’ data contained in the dataset, a linear regression modeled can be established. Thus, the linear model describes the players in a statistical manner for better evaluations for players’ averaged proficiency.


Introduction
Fencing or swordsmanship was first used by Egyptians around 3000 years ago for self-defense and combat.They developed numerous techniques as well as different types of swords for battles and dueling.Modern fencing was mainly developed during the Renaissance by the Italians and modified by the French.This is the reason that Italy and France have always been leading the Olympic and World Championship fencing medals1.During the Renaissance, only the royalties in France and Italy practiced fencing, and fencing was used mainly for dueling.Later in the 18th century, fencing gradually developed into a sport and was practiced by most European countries [1,2], shown as Fig. 1.Image adopted from https://fencingprodigy.com/ Figure 1: The history of fencing in a timeline.
Fencing was introduced to the world through the Olympic games.However, only Foil and Sabre matches were part of the first Olympic games, as Epé e was introduced to the Olympics in the Paris Olympics in 1900.Today, fencing is an important part of the Summer Olympics and European countries like France and Italy had always been the strongest in fencing 2.
In fencing, the two opposing athletes each try to touch the other opponent with its sword in specific areas to score, and every touch scores one point.This specific area differs with the three different weapons.Fencing matches differs from pool matches to direct elimination matches.In pool, everyone in the pool fences each other one for a five-point-bout, meaning the first person to score five-point wins.The pool matches will provide a pool results, which decides the fencers for direct elimination.This is the same as group stage and knout out stage for many competitions in soccer, like the World Cup or the Champions League.After pools in national competitions, a certain percentage of the bottom fencers will be eliminated; this number varies in different competitions [3,4].However, in regional competition, no one gets directly eliminated after pools.For direct elimination, the matches are fifteen-point-bouts, and the winners advance to the next round while the losers get knouted out.This continues until the finals and one fencer wins the tournament.Image adopted from https:/stock.adobe.com/In epee, anywhere from head to toe is valid, while in foil and saber, only the mask and lamé is valid for a point.The saber lamé is arm and body while foil lamé only includes body3.Both foil and sabre has priority, which is also called the right of way.This means that one fencer will also have priority over the other, and when both person touches at the same time, the fencer with priority gets the point.This way, only one person will score a point each round.Epee does not have priority, so every touch counts as a point, and it is possible for both fencers to score a point in the same round.
Both foil and epee gets a point by stabbing the opponent, while in sabre, people usually slash the opponent with the blade.During the direct elimination stage, both foil and epee matches are separated into three periods, each period being three minutes.There is a minute of resting time between each period.In sabre, there are only two periods with a minutes of resting point between.The first period ends when a fencer reaches eight points, and the second period ends with the end of the match.
Fencing swords are different in different games as shown in Image adopted from https:/stock.adobe.com/ Figure 2. Epee is the one on the bottom of Figure 2 and is the largest and heaviest among the three.Epee has a round guard.Foil is similar to epee but just smaller and lighter at the blade and the guard.The weapon in the middle of Figure 2 is foil.Sabre is different than the other two as sabre has a guard that goes around the hand and connects to the end of the grip.Sabre also does not have a point in the front.

Evaluation model and variables
Based on personal competition experience, understanding of fencers, and extensive literature research, here are some key characteristics of fencers, as shown in Figure 2. We believe that the five most crucial characteristics of fencers are as follows: First, arm span.Arm span, as a key factor in the offense, determines the attacking distance.Additionally, the best defense is a good offense, so a larger arm span helps to suppress and alleviate defensive pressure from opponents.Finally, posture and balance are closely related to arm span.Second, leg length [5].Third, agility.Agility refers to the intervals between actions.Fourth, speed.Fifth, is reaction speed [6], shown as Figure 3.

Model exploration
Based on the discussion of the key characteristics mentioned above, we can easily establish a linear system of equations model to characterize the "fencing proficiency factors" of several athletes. (1) Based on this multiple linear equation system, after collecting the parameters of 6 athletes, we can fully establish the equation system and solve for the coefficients.The intercept b represents a common base for all athletes.We can express the above linear equation system in matrix form as follows: (2) By utilizing the properties of matrices, we can directly solve for the coefficients, as shown in the equation below: (3) For the specific implementation mentioned above, we can utilize functions from the numerical computing package, Numpy, in Python.Firstly, we collect the data from matrix X and create the matrix X.Then, we use numpy.linalg.inv to calculate the inverse matrix of X, denoted as X^(-1).Finally, we perform matrix multiplication between X^(-1) and Y to obtain the contribution factors, namely k_1~k_5 and b.
Once we have obtained these contribution factors and the equation, we can accurately describe these six athletes 7 .

Linear regression
For situations with more than six athletes, we need to extend the linear system model.Thus, we transition from a linear system problem to an "overdetermined problem," where the number of equations (i.e., number of athletes) is much larger than the number of unknowns.In this case, we are unable to find unknowns that satisfy all the equations exactly, but we can find an approximate solution that satisfies the equations to a certain degree.In this situation, the linear system problem becomes a linear regression problem.We can express linear regression in the matrix form.
In the matrix is the same as the matrix form of a linear system, except that the number of rows far exceeds the number of rows in the linear system.For example, if we collect data from 50 athletes, then this matrix becomes 50 rows.Similarly, through the matrices X and Y, we can obtain the contribution factors, namely k_1 to k_5 and b.

Model results
From a statistical perspective, we can apply the formula method (4) From a statistical perspective, we can apply the formula method.In this case, X' represents the transpose of matrix X.What is the numerical value of the solution obtained?
Here, due to the nature of linear regression, the model's estimation of athlete's performance often deviates from the true value.This difference is known as the residual.In other words, linear regression provides an average value of the performance for a group of athletes.When an athlete is exceptionally strong or weak, their performance will significantly deviate from this statistical average.However, most athletes will have their performance level near the corresponding average.
In terms of implementation, we utilize the machine learning package scikit-learn in Python.Specifically, we use the linear regression model.This model provides the same results as the regression model in statistics but incorporates some elements of machine learning.First, we create an empty linear regression model using the command mymodel = LinearRegression().Then, we train the model (in the field of machine learning, training means inputting data into the model and optimizing it).The training command is mymodel.fit(X,Y).Once training is complete, the contribution factors are stored in mymodel.coef_and mymodel.intercept.These parameters can be used to build an evaluation model for fencers and then incorporated into a web-based interactive module for display and user interaction.

Final Results
This project utilizes HTML and JavaScript for interactive design.HTML is a common language for webpages, including various forms of text, formatting, images, hyperlinks, resources, etc.A sketch image is added to the right side of the webpage to depict the situation during fencing.However, traditional HTML is designed for static webpages, which can only passively display content and cannot interact with users.To enable the webpage to receive user instructions, we use the JavaScript language in conjunction with HTML for interactive design.Specifically, we use the document.getElementByIdmethod in JavaScript to obtain the objects of five text boxes and retrieve their contents.Based on the model from the previous section, we calculate the athlete's score and pass it as data to the result object (also obtained using the document.getElementByIdmethod).These processes are triggered by clicking the "calculate!" button, shown as Figure 4.

Summary
This project fully demonstrates an understanding of fencing, explaining the sport from historical, rule, and sword type perspectives [7].Based on the author's understanding of fencing, modeling is conducted, taking into account the athlete's arm length, speed, agility, and other characteristics, to comprehensively score the athletes.Starting from a system of multivariate linear equations, statistical factors are further considered, introducing a linear regression model.This model can provide statistically significant explanations based on a large amount of athlete data.Due to the characteristics of the statistical model, most athletes conform to the statistical scoring, while a few exceptional athletes deviate from the statistical scoring.An example can be given to illustrate this.I have been fencing I created this fencing model to estimate the strength of people in fencing.The strength starts from 0, which is not knowing how to fence at all, and 250 is about the best fencer in America.The fencing model uses 5 variables to determine the strength: arm length, leg length, agility, speed, and sight.In fact, this model can be further expanded, such as incorporating training duration or athlete's state, in order to predict the athlete's level more accurately.It can also be updated with season data or integrated with competition analysis.The modeling can be applied to the three different subdisciplines of fencing, analyzing the differences in factors between the foil and epee events.Further exploration in this direction can be considered in the future.

Figure 2 :
Figure 2: Different fencing swords.Fencing swords from top to the bottom: saber, foil and epee.

Figure 4 :
Figure 4: The final design of the web page with interactive models on the bottom of the left panel.