0% found this document useful (0 votes)
1 views

Foundation of Data Science 2

Uploaded by

medareddy765
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Foundation of Data Science 2

Uploaded by

medareddy765
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Foundation of Data Science – BCSE206L

TOPIC:-ATHLETIC PERFORMANCE ANALYSIS

GROUP NO – 24
T.JATAVEDA 22BDS0391
M.SAAKETH 22BCE2683
G.ABHINAV 22BCE3750

1. Project Overview
Objective:

Project Overview

The goal is to develop an Athletic Performance Analysis System that collects,processes, and
analyzes real-time performance data of athletes. The system should handle both structured
(SQL) and unstructured (NoSQL/JSON) data, process realtime metrics, and provide
personalized insights for performance optimization.
The goal is to develop an Athletic Performance Analysis System that collects, processes,
and analyzes real-time performance data of athletes. This system should:

 Handle structured data (SQL) such as player profiles, performance statistics, and
match records.
 Handle unstructured data (NoSQL/JSON) such as sensor outputs, wearable device
logs, and GPS data.
 Provide real-time analytics and feedback to enhance performance.
 Generate personalized training recommendations based on historical and current
metrics.

Key Capabilities:

 Real-time data ingestion from IoT devices (e.g., wearables, trackers).


 Statistical and machine learning-based performance evaluation.
 Visual dashboards for coaches and athletes.
 Prediction of fatigue, injury risk, and performance trends.
Module 4: Data Analytics on Text
(Applied to Athletic Performance Analysis)
1. Major Text Mining Areas

Text mining plays a crucial role in handling unstructured textual data such as coach feedback,
athlete interviews, medical reports, and match commentaries. The main areas include:

 Information Retrieval (IR):


o Concerned with finding relevant textual data from a large collection.
o In sports, IR can be used to search past injury reports, performance summaries,
or specific events from match commentary.
 Information Extraction:
o Extracts structured information like player names, performance metrics, and
timestamps from raw text.
o For example, from "Player X scored a goal at 45 mins", we can extract:
o Player = X, Event = goal, Time = 45.
 Text Classification:
o Automatically assigns labels to text, e.g., classifying coach remarks into
"positive", "neutral", or "negative".
o Helpful in analyzing team morale or player performance trends from reports.
 Clustering:
o Groups similar texts without pre-defined categories.
o For instance, clustering medical reports by symptom similarity or performance
reviews by playing styles.
 Sentiment Analysis:
o Determines the emotional tone (positive, negative, neutral) of a document.
o Valuable for assessing player feedback, fan responses, and coach comments to
gauge overall sentiment.

2. Text Analytics Tasks


Cleaning and Parsing

 Text Cleaning: Involves removing punctuation, stop words (like “the”, “is”), and
lowercasing text.
 Parsing: Breaks text into smaller parts like tokens (words), sentences, etc., for easier
processing.

Searching and Retrieval

 Utilizes keyword or context-based searches to find relevant textual data from logs or
match commentary archives.
 Example: Searching for "injury" mentions across all player records to identify
recurring issues.

Text Mining

 Involves pattern recognition, trend analysis, and discovering hidden insights from
textual data.
 Example: Identifying that players tend to perform better in matches following positive
coach reviews.
Part-of-Speech (POS) Tagging

 Assigns grammatical categories (noun, verb, adjective) to each word in the text.
 Useful in syntactic analysis of performance descriptions or feedback for deeper
linguistic analysis.

Stemming

 Reduces words to their root form (e.g., “running”, “ran”, “runs” → “run”).
 Helps unify different forms of the same word for consistent analysis.

Text Analytics Pipeline

A step-by-step flow of text processing:

1. Data Collection – Collect unstructured data (e.g., reports, logs).


2. Cleaning – Remove noise, tokenize, and normalize.
3. Feature Extraction – Convert text into numerical form (TF-IDF, Bag-of-Words).
4. Modeling – Apply classification or clustering algorithms.
5. Evaluation – Assess performance (accuracy, recall, etc.)
6. Interpretation – Translate results into actionable insights for athlete development.

Task Description
Cleaning & Parsing Remove noise, format text for analysis
Searching & Retrieval Find player-specific notes using keywords
Text Mining Extract insights from match-day blogs or feedback notes
Part-of-Speech Identify action-related verbs like "sprint", "missed", "scored"
Tagging
Stemming Normalize "running", "ran", "runs" → "run"
Text Analytics Pipeline End-to-end processing from raw feedback → structured
insights

3. Natural Language Processing (NLP)


Major Components of NLP

 Lexical Analysis: Tokenizes text and removes redundant components.


 Syntactic Analysis: Checks grammar using POS tagging and parsing.
 Semantic Analysis: Understands the meaning behind sentences.
 Discourse Integration: Interprets relationships across sentences.
 Pragmatic Analysis: Considers context and intentions in communication.

Stages of NLP

1. Lexical & Syntactic Analysis – Tokenizing and tagging words.


2. Semantic Parsing – Creating meaning representations.
3. Entity Recognition – Identifying names, events, places.
4. Co-reference Resolution – Linking pronouns to nouns (e.g., “he” → “Messi”).
5. Intent Detection – Understanding user/player intent in feedback or logs.

NLP Applications in Athletic Analysis

 Automated Summary: Summarizing game commentary or post-match interviews.


 Chatbots: Assisting athletes with training schedules or feedback.
 Emotion Detection: From text-based athlete or fan reactions.
 Health Log Analysis: Detecting injury risks from recurring symptoms in reports.

Predictive Modeling & Model Evaluation –


Applied to Athletic Performance Analysis
1. Predictive Modeling: Overview

Predictive modeling involves creating statistical or machine learning models that forecast
outcomes based on historical data. In the case of athletic performance, we aim to:

 Predict match performance (e.g., goals, stamina loss).


 Anticipate injury risk.
 Recommend personalized training.

Example Use Cases:


Goal Predictive Feature Outcome
Injury Risk Forecast Past injuries, fatigue, BMI, minutes High/Low Risk
played
Performance Boost Stamina, agility, match intensity Recommend
Planning recovery/training
Scouting Players Speed, shooting, passes, market value Performance Class (A/B/C)

2. Steps in Predictive Modeling


2.1 Data Selection

Select relevant features such as:

 Stamina, SprintSpeed, Agility, Dribbling, BallControl, Reactions, Aggression

2.2 Feature Engineering

New variables are derived:

 PerformanceIndex = (Dribbling + Passing + Reactions) / 3


 Flagging athletes with FatigueIndex > 75%

2.3 Splitting Data

Split dataset into:

 Training Set (70%) – to train the model


 Testing Set (30%) – to evaluate the model’s accuracy

2.4 Selecting Algorithms

Algorithms used:

ALGORITHM USE CASE


LOGISTIC REGRESSION Predict if player performs well (1) or not (0)
DECISION TREES Understand key attributes influencing outcomes
RANDOM FOREST Better accuracy by combining multiple trees
KNN Identify similar players based on metrics
3. Model Evaluation

Once a model is trained, it must be evaluated to check if it's reliable for making real-world
predictions.

Evaluation Metrics:
Metric Description Relevance to Project
Accuracy Percentage of correct predictions Overall performance prediction
accuracy
Precision Proportion of true positive predictions Predicting high-performing players
Recall True positives detected among all actual Injury detection sensitivity
positives
F1 Score Harmonic mean of precision and recall Balance between precision and
recall
Confusion Detailed count of TP, TN, FP, FN Performance classification
Matrix breakdown
ROC-AUC Curve showing the trade-off between TPR Evaluating model quality
and FPR

Example Confusion Matrix for Performance Classifier:


PREDICTED HIGH PREDICTED LOW
ACTUAL HIGH TP = 120 FN = 20
ACTUAL LOW FP = 10 TN = 100

4. Model Deployment

Deployment means making the trained model available for real-time usage—either in a
dashboard or application.

Techniques:

 REST APIs: Deploy Python model via Flask for mobile/web usage.
 Model in Production: Embedded in sports analytics platforms for coaches.
 Real-Time Monitoring: Evaluate if the model's prediction remains accurate over
time.

5. Takeaways

 Predictive models help coaches and analysts make informed decisions.


 Proper evaluation ensures model performance is trustworthy.
 Deployment enables real-time feedback and athlete tracking.
Module 5: Platform for Data Science
1. Python for Data Science
Python Libraries

 NumPy – For numerical computations, efficient arrays, used for storing metrics like
speed or agility.
 Pandas – For data wrangling, data frames for structured athletic data like goals,
assists, match stats.
 Matplotlib / Seaborn – For creating performance graphs, trend lines.
 Scikit-learn – For building ML models (clustering, regression, classification).
 NLTK / SpaCy – For text processing, sentiment analysis on comments or coach
feedback.

Library Purpose
pandas Data handling, reading performance logs
numpy Numerical operations (e.g., velocity calculations)
matplotlib Visualizing performance trends
seaborn Advanced performance heatmaps or comparisons
scikit-learn ML model training for prediction
nltk, spaCy NLP operations on feedback data

Data Frame Manipulation with NumPy and Pandas

 Using Pandas to:


o Load CSV files (like the FIFA dataset).
o Handle missing values, convert formats, and filter relevant attributes (e.g.,
goals, stamina).
o Apply group-by functions for team-wise or player-wise analysis.

o df.groupby('position')['distance_covered'].mean()

Exploratory Data Analysis (EDA)

 Initial investigation of datasets to uncover patterns using:


o Descriptive statistics (mean, median, mode)
o Visualizations like bar plots, heatmaps, pairplots
o Correlation matrices to study attribute relationships (e.g., speed vs. agility)

Time Series Dataset

 Monitoring metrics over time (e.g., stamina per match, injury frequency).
 Applying time series plots and trend forecasting to visualize performance
improvements or declines.

Clustering with Python

 Grouping players based on similarities using:


o K-means (e.g., cluster players by playstyle – attacker, midfielder, defender)
o Hierarchical clustering for team-based performance analysis.
Dimensionality Reduction

 Techniques like PCA (Principal Component Analysis) to:


o Reduce redundant attributes.
o Improve model performance and visualization.
o Example: Reduce 15+ performance metrics to 2 or 3 key influencing factors.

2. Python IDEs for Data Science

 Jupyter Notebook – Interactive coding, visualization inline, ideal for EDA.


 PyCharm – Full-featured IDE, great for modular projects.
 Google Colab – Cloud-based, supports GPU, good for team collaborations and model
training.

IDE FEATURES
JUPYTER NOTEBOOK Interactive coding, visual outputs
PYCHARM Full-featured, great for long scripts
VSCODE Lightweight, supports extensions and notebooks
GOOGLE COLAB Cloud-based, free GPU for performance modeling

Module 6: Tableau for Data Visualization


1. Tableau Introduction

Tableau is a powerful data visualization tool used to convert raw data into interactive
dashboards and visual reports. It helps identify trends, patterns, and outliers in data, especially
when dealing with complex sports performance metrics.

2.Dimensions vs Measures

 Dimensions: Categorical data like player name, position, team.


 Measures: Numerical data like goals scored, assists, stamina.

Dimension Examples Measure Examples


Player Name Overall, Age, Stamina
Club Sprint Speed, Strength
Position Ball Control, Acceleration

3..Descriptive Statistics

 Displaying mean, median, range, and deviation in performance metrics.


 Example: Average distance run per match, or average stamina.

 Average Overall by Position


 Maximum Sprint Speed by Nationality
 Median Stamina by Age group
 Standard Deviation of Strength across club.
4. Basic Charts

These are the key visualizations for your Tableau dashboard:

A. Bar Chart – Top 10 Athletes by Sprint Speed

 X-axis: Player Name


 Y-axis: Sprint Speed
 Filter: Overall > 85
 Insight: Who are the fastest elite athletes?

B. Boxplot – Stamina Distribution by Position

 X-axis: Position
 Y-axis: Stamina
 Insight: Which positions maintain the highest average stamina?

C. Line Chart – Performance vs Age

 X-axis: Age
 Y-axis: Average Overall Rating
 Insight: How does performance vary with age?

D. Heatmap – Correlation Between Attributes

 Attributes used: Acceleration, Strength, Stamina, Overall


 Insight: Identify strongly correlated physical and skill metrics

E. Map View – Nationality Distribution

 Location: Country
 Size/Color: Number of athletes
 Insight: Countries producing the highest number of top performers

5. Dashboard Design Principles

In your Tableau dashboard:

 Use filters to toggle by club, nationality, or age.


 Create a KPI panel showing:
o Avg. Overall
o Top Speed
o Median Age
 Color-code metrics (green for high stamina, red for low strength)
 Use tooltips for drill-down information (e.g., click on a bar to see player bio)

6. Special Chart Types

 Tree Maps: Show player count by club and position.


 Bullet Graphs: Compare actual vs target strength or sprint benchmarks.
 Scatter Plots: For agility vs acceleration by age group.

7. Integrate Tableau with Google Sheets


 Maintain a live athlete performance sheet (e.g., Google Sheets with match stats).
 Use Tableau Public to connect and auto-refresh data.
 Embed dashboards in reports or presentations.

1. Setup and Imports


python
CopyEdit
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Load the dataset


df = pd.read_csv("fifa_eda_stats.csv")

# Display basic info


print(df.info())
df.head()

2. Bar Chart – Top 10 Athletes by Sprint Speed


python
CopyEdit
top_sprinters = df[df['Overall'] > 85].sort_values('SprintSpeed', ascending=False).head(10)

plt.figure(figsize=(12, 6))
sns.barplot(data=top_sprinters, x='Name', y='SprintSpeed', palette='viridis')
plt.title("Top 10 Athletes by Sprint Speed (Overall > 85)")
plt.xticks(rotation=45)
plt.ylabel("Sprint Speed")
plt.xlabel("Player Name")
plt.tight_layout()
plt.show()

3. Boxplot – Stamina Distribution by Position


python
CopyEdit
plt.figure(figsize=(12, 6))
sns.boxplot(data=df, x='Position', y='Stamina', palette='Set2')
plt.title("Stamina Distribution by Playing Position")
plt.xticks(rotation=45)
plt.ylabel("Stamina")
plt.xlabel("Position")
plt.tight_layout()
plt.show()

4. Line Chart – Average Overall Rating by Age


python
CopyEdit
avg_rating_by_age = df.groupby('Age')['Overall'].mean().reset_index()

plt.figure(figsize=(10, 5))
sns.lineplot(data=avg_rating_by_age, x='Age', y='Overall', marker='o', color='orange')
plt.title("Average Overall Rating by Age")
plt.xlabel("Age")
plt.ylabel("Average Rating")
plt.grid(True)
plt.tight_layout()
plt.show()

5. Heatmap – Correlation Between Key Attributes


python
CopyEdit
features = ['Overall', 'Stamina', 'Strength', 'SprintSpeed', 'Acceleration', 'Agility']
corr_matrix = df[features].corr()

plt.figure(figsize=(8, 6))
sns.heatmap(corr_matrix, annot=True, cmap='coolwarm', fmt='.2f')
plt.title("Correlation Between Physical and Skill Attributes")
plt.tight_layout()
plt.show()

6. Map View (Simulated with Bar Chart) – Nationality Distribution


python
CopyEdit
top_nations = df['Nationality'].value_counts().head(10)

plt.figure(figsize=(10, 6))
sns.barplot(x=top_nations.values, y=top_nations.index, palette='magma')
plt.title("Top 10 Countries with Most Athletes")
plt.xlabel("Number of Players")
plt.ylabel("Country")
plt.tight_layout()
plt.show()

7. Scatter Plot – Agility vs Acceleration by Age Group


python
CopyEdit
plt.figure(figsize=(10, 6))
sns.scatterplot(data=df, x='Acceleration', y='Agility', hue='Age', palette='cool', alpha=0.6)
plt.title("Agility vs Acceleration Colored by Age")
plt.xlabel("Acceleration")
plt.ylabel("Agility")
plt.legend(title='Age', bbox_to_anchor=(1.05, 1), loc='upper left')
plt.tight_layout()
plt.show()

8. Descriptive Statistics Output


python
CopyEdit
print("Average Overall Rating:", df['Overall'].mean())
print("Maximum Sprint Speed:", df['SprintSpeed'].max())
print("Median Stamina:", df['Stamina'].median())
print("Standard Deviation of Strength:", df['Strength'].std())

Visualization Code Using NumPy, Pandas, Matplotlib, and Seaborn


python
CopyEdit
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Load the dataset


df = pd.read_csv('fifa_eda_stats.csv')

# Set style
sns.set(style="whitegrid")

# 1. Distribution of Overall Player Ratings


plt.figure(figsize=(10, 5))
sns.histplot(df['Overall'], kde=True, bins=30, color='skyblue')
plt.title('Distribution of Overall Player Ratings')
plt.xlabel('Overall Rating')
plt.ylabel('Frequency')
plt.tight_layout()
plt.show()
# 2. Top 10 Players by Overall Rating
top10 = df[['Name', 'Overall']].sort_values(by='Overall', ascending=False).head(10)
plt.figure(figsize=(10, 6))
sns.barplot(data=top10, x='Overall', y='Name', palette='viridis')
plt.title('Top 10 Players by Overall Rating')
plt.xlabel('Overall Rating')
plt.ylabel('Player Name')
plt.tight_layout()
plt.show()

# 3. Position-wise Average Player Rating


pos_avg = df.groupby('Position')['Overall'].mean().sort_values(ascending=False).head(10)
plt.figure(figsize=(12, 6))
sns.barplot(x=pos_avg.values, y=pos_avg.index, palette='magma')
plt.title('Top 10 Positions by Average Overall Rating')
plt.xlabel('Average Overall Rating')
plt.ylabel('Position')
plt.tight_layout()
plt.show()

# 4. Correlation Heatmap of Numeric Features


plt.figure(figsize=(14, 10))
numeric_cols = df.select_dtypes(include='number')
sns.heatmap(numeric_cols.corr(), annot=True, cmap='coolwarm', fmt='.2f')
plt.title('Correlation Heatmap of Numeric Features')
plt.tight_layout()
plt.show()

# 5. Age vs. Overall Rating Scatter Plot


plt.figure(figsize=(10, 6))
sns.scatterplot(data=df, x='Age', y='Overall', alpha=0.5, hue='Potential', palette='cool')
plt.title('Age vs. Overall Rating')
plt.xlabel('Age')
plt.ylabel('Overall')
plt.tight_layout()
plt.show()

# 6. Club-wise Count of Players (Top 10 Clubs)


club_counts = df['Club'].value_counts().head(10)
plt.figure(figsize=(12, 6))
sns.barplot(x=club_counts.values, y=club_counts.index, palette='cubehelix')
plt.title('Top 10 Clubs by Number of Players')
plt.xlabel('Number of Players')
plt.ylabel('Club')
plt.tight_layout()
plt.show()
:

Summary
These visualizations using NumPy, Pandas, Seaborn, and Matplotlib simulate the Tableau-style
insights:

 Visual breakdown of athlete strengths


 Attribute correlations
 Country-based distributions
 Age-performance relationships

You might also like