I’ve made it midway via bootcamp and finished my third and favorite project to this point! The last few weeks we’ve been studying about SQL databases, classification fashions equivalent to Logistic Regression and Assist Vector Machines, and visualization instruments such as Tableau, Bokeh, and Flask. I put these new abilities to use over the past 2 weeks in my project to classify injured pitchers. This post will define my process and analysis for this project. All of my code and project presentation slides could be discovered on my Github and my Flask app for this project may be discovered at mlb.kari.codes.
For this project, my challenge was to predict MLB pitcher injuries utilizing binary classification. To do this, I gathered data from several sites together with Baseball-Reference.com and MLB.com for pitching stats by season, Spotrac.com for Disabled List information per season, and Kaggle for 2015–2018 pitch-by-pitch data. My goal was to make use of aggregated data from earlier seasons, to predict if a pitcher can be injured in the following season. The necessities for this project had been to store our data in a PostgreSQL database, to utilize classification models, and to visualize our data in a Flask app or create graphs in Tableau, Bokeh, or Plotly.
I gathered information from the 2013–2018 seasons for over 1500 Major League Baseball pitchers. To get a feel for my knowledge, I began by taking a look at features that had been most intuitively predictive of injury and compared them in subsets of injured and wholesome pitchers as follows:
I first looked at age, and while the mean age in both injured and healthy gamers was around 27, the information was skewed a little bit in another way in each groups. The most common age in injured gamers was 29, while healthy players had a a lot lower mode at 25. Equally, average pitching velocity in injured players was higher than in wholesome players, as expected. The subsequent function I considered was Tommy John surgery. This is a quite common surgery in pitchers the place a ligament in the arm gets torn and is changed with a healthy tendon extracted from the arm or leg. I used to be assuming that pitchers with past surgeries were more likely to get injured once more and the information confirmed this idea. A significant 30% of injured pitchers had a past Tommy John surgical procedure while wholesome pitchers had been at about 17%.
I then checked out average win-loss file within the two groups, which surprisingly was the feature with the highest correlation to injury in my dataset. The subset of injured pitchers had been successful a mean of forty three% of games compared to 36% for healthy players. It makes sense that pitchers with more wins will get more taking part in time, which can lead to more injuries, as shown within the higher average innings pitched per game in injured players.
The characteristic I was most concerned about exploring for 메이저리그중계 this project was a pitcher’s repertoire and if sure pitches are more predictive of injury. Looking at function correlations, I found that Sinker and Cutter pitches had the highest constructive correlation to injury. I made a decision to discover these pitches more in depth and regarded at the proportion of mixed Sinker and Cutter pitches thrown by individual pitchers every year. I seen a sample of injuries occurring in years where the sinker/cutter pitch percentages were at their highest. Below is a pattern plot of 4 leading MLB pitchers with current injuries. The red points on the plots symbolize years in which the gamers had been injured. You possibly can see that they often correspond with years in which the sinker/cutter percentages had been at a peak for every of the pitchers.