Clara SELLAM
347723173
https://youtu.be/MebFE0WUfww
Introduction
The objective of this project is to understand what drives the commercial success of video games and to evaluate whether we can predict their global sales using historical industry data.
To explore this question, we analyze a dataset containing information about platforms, publishers, genres, release years, and critic/user scores. Our goal is to identify meaningful patterns and build machine learning models capable of predicting:
Which factors contribute most to the commercial success of a video game, and can we predict that success ?
Part 1: Data Selection and Initial Loading
Objective
Acquire and load the video game sales dataset to start the exploratory data analysis (EDA) and prepare it for subsequent modeling tasks.
Steps Performed
-
Dataset Download
- The dataset was downloaded from Kaggle using the
kagglehub interface.
- All files were stored locally, ensuring reproducibility.
-
Loading the Main CSV
- The main CSV file (
Video_Games.csv) was read into a Pandas DataFrame.
- Exceptions during download or loading were handled to ensure smooth execution.
-
Initial Inspection
- Column names were standardized (spaces removed, special characters cleaned) for consistency.
- The dataset contains X rows and Y columns (adjusted according to actual df.shape), meeting the minimum requirement of 10k rows and 15 features.
- The first rows were displayed for a quick overview of the data.
Part 2: Exploratory Data Analysis (EDA)
Objective
Perform a preliminary exploration of the dataset to understand its structure, data types, and basic statistics, which will guide feature selection and preprocessing.
Steps Performed
-
Visual Preview
- The first 20 rows of the dataset were displayed.
- This provides an initial look at the features, their values, and potential anomalies or inconsistencies.
-
Descriptive Statistics
- Basic statistics (mean, median, min, max, standard deviation) were computed for numerical columns.
- This helps identify the distribution, spread, and potential outliers in key variables such as sales and scores.
-
Structural Inspection
- Data types and non-null counts were checked using
df.info().
- Ensured that each feature is in the expected format and identified any missing values that may need handling.
Outcome
- Gained a clear understanding of dataset dimensions, types, and value distributions.
- Identified features suitable for regression and classification targets.
- Set the foundation for feature engineering and further data preprocessing.
Part 2.2: Data Cleaning – Handling Missing Values, Typos, and Duplicates
Objective
Prepare the dataset for analysis and modeling by removing duplicates, handling missing values, correcting typos, and ensuring proper data types.
Steps Performed
-
Duplicate Handling
- Checked for exact duplicate rows in the dataset.
- Removed all duplicate entries to ensure data integrity.
-
Handling Missing Values
- Typos Correction: Replaced 'tbd' (To Be Determined) in
User_Score with NaN to allow numeric operations.
- Critical Row Deletion: Dropped rows missing essential features such as
Publisher, Developer, Genre, Year_of_Release, and Name.
- Median Imputation: For numeric score and count columns (
Critic_Score, User_Score, Critic_Count, User_Count), missing values were replaced with the median to preserve as many rows as possible, especially for older or less popular games.
-
Data Type Correction
- Ensured that
Year_of_Release, Critic_Count, and User_Count are integers for consistency in analysis.
-
Final Integrity Check
- Verified that no missing values remain in the cleaned DataFrame.
- Confirmed the dataset is consistent and ready for exploratory data analysis and feature engineering.
Part 2.3: Outlier Detection and Handling Justification
Objective
Analyze the target variable Global_Sales for outliers and skewness, apply a transformation to reduce extreme asymmetry, and create a preliminary classification target.
Steps Performed
-
Skewness Analysis
- Calculated the skewness of
Global_Sales.
- Checked maximum and median values to understand the distribution and presence of extreme outliers.
- Visualized the distribution using a Box Plot and Histogram.
-
Decision on Outliers
- The skewness was extremely high (>1), indicating that the dataset contains 'super-successes' (blockbusters) acting as strong outliers.
- A logarithmic transformation (
np.log1p) was applied to reduce skewness for regression modeling.
-
Target Transformation
- Created a new regression target:
Log_Global_Sales = log1p(Global_Sales).
- Skewness after transformation was significantly reduced.
- Created a preliminary classification target
Sales_Success based on the median:
0 → Sales ≤ median
1 → Sales > median
-
Visualization Post-Transformation
- Confirmed the log-transformed target distribution is more symmetrical.
- Graphs saved for both original and transformed distributions.
Outcome
- Outliers identified and addressed through logarithmic transformation.
- Regression target (
Log_Global_Sales) prepared for modeling.
- Preliminary classification target (
Sales_Success) created for further analysis.
- Dataset is ready for feature engineering and modeling steps.


Part 2.4: Correlations and Advanced Descriptive Statistics
Objective
Analyze the relationships between numerical features and the regression target (Log_Global_Sales), explore categorical variable distributions, and identify multicollinearity risks before modeling.
Steps Performed
1. Correlation Analysis with the Regression Target
- Selected only numerical features after cleaning.
- Excluded:
Global_Sales (original untransformed target)
Sales_Success (classification target)
- Computed the correlation matrix.
- Extracted and ranked correlations with
Log_Global_Sales.
- Displayed results in a structured table.
2. Descriptive Statistics for Categorical Variables
Focused on key low-cardinality categorical features:
For each feature, the following were computed:
- Number of unique categories
- Top 5 most frequent categories
- Maximum frequency percentage
This helps understand market concentration and dominant segments.
3. Correlation Heatmap Visualization
- Created a heatmap of the correlation matrix.
- Used visual intensity to identify:
- Strong linear relationships
- Redundant variables
- Potential multicollinearity issues

Key Insights
-
Regional Sales Multicollinearity
NA_Sales, EU_Sales, JP_Sales, and Other_Sales show very strong correlations (>0.90) with each other and with the target.
- These features must be dropped or combined before Linear Regression to prevent multicollinearity.
-
Best External Predictors
Critic_Score and Critic_Count show moderate positive correlations (~0.45) with sales.
- These variables are strong candidates for predictive modeling.
-
High Cardinality in Categories
Platform and Publisher contain many unique values.
- This confirms that feature encoding will be required in the next step.
Part 2.5.1: Research Question 1 – Impact of Scores on Global Sales
Research Question
Do critic scores and user scores have an impact on global video game sales?
Objective
Evaluate the relationship between:
Critic_Score
User_Score
and the regression target:
Log_Global_Sales
The goal is to determine whether professional or user reviews are better predictors of commercial success.
Methodology
- Selected the following numerical variables:
Critic_Score
User_Score
Log_Global_Sales
- Used scatter plots with regression lines (regplot) to visualize the relationships.
- Computed the Pearson correlation coefficient for each score type.
- Applied transparency to better visualize dense data points.
- Saved the resulting visualization for reporting.
Key Findings
- Both Critic_Score and User_Score show a moderate positive correlation with global sales.
- The correlation is slightly stronger for
Critic_Score than for User_Score.
- This suggests that professional reviews tend to be a better predictor of sales performance than user ratings.
Conclusion
Video games with higher review scores generally achieve better commercial performance, especially when those scores come from professional critics. These variables will therefore play a key role in the predictive models.

Part 2.5.2: Research Question 2 – Best Performing Platform
Research Question
Which gaming platforms achieve the highest average global sales?
Objective
Identify the platforms with the highest average Log_Global_Sales, in order to understand which gaming systems historically generated the strongest commercial performance.
Methodology
- Grouped the dataset by the
Platform feature.
- Computed the mean of
Log_Global_Sales for each platform.
- Selected the Top 10 platforms with the highest average transformed sales.
- Visualized the results using a bar chart.
- Saved the graph for reporting and interpretation.
Key Findings
- Platforms such as NES and GB (Game Boy) appear among the top performers in terms of average sales per game.
- These platforms benefited from a small number of extremely successful games, such as:
- Their high average does not necessarily reflect large market size, but rather the impact of a few legendary titles.
Important Insight
High average sales do not always mean dominant market share. In this case, the results are influenced by:
- A limited number of games
- Exceptional blockbuster success
This confirms the importance of combining average performance metrics with market volume indicators in business analysis.
Conclusion
While older platforms like NES and Game Boy dominate in terms of average sales, this result highlights the impact of historical blockbusters rather than consistent large-scale production. Platform effects should therefore be interpreted with caution in predictive modeling.

Part 2.5.3: Research Question 3 – Genre and Critic Score Interaction
Research Question
Does the impact of critic scores on sales vary depending on the game genre?
Objective
Analyze how Critic Score interacts with Genre to influence Log_Global_Sales, and determine whether high review scores consistently enhance sales across different game categories.
Methodology
- Computed the median Critic Score to define two groups:
- High Score: Games with Critic_Score ≥ median
- Low Score: Games with Critic_Score < median
- Filtered the dataset to retain only the Top 10 most frequent genres for better visualization clarity.
- Created a boxplot showing:
- Sales distribution (
Log_Global_Sales)
- By Genre
- Split by High vs. Low Critic Score
- Saved the visualization for reporting and diagnostic analysis.
Key Findings
- For most major genres such as Shooter, Platform, and Action:
- Games with a High Critic Score show:
- Higher median sales
- A higher upper sales ceiling
- Low-score games consistently show:
- Lower central tendency
- More limited commercial performance
Important Insight
This analysis demonstrates that critic reviews play a major role in commercial success, and this effect:
- Is consistent across genres
- Is not limited to a specific category of games
- Acts as a strong universal sales driver
Conclusion
High-quality reviews significantly boost sales across nearly all video game genres. Critic evaluation therefore represents a powerful predictive feature for commercial performance, reinforcing its importance for both regression and classification modeling tasks.

Part 2.5.4: Research Question 4 – Sales Volatility by Genre
Research Question
Which video game genres show the highest sales volatility, and which genres are the most stable in terms of performance?
Objective
Analyze the distribution and variability of sales across different game genres in order to:
- Identify stable vs. risky genres
- Compare median performance and volatility
- Understand risk–return profiles across genres
Methodology
- Used a box plot visualization to display the distribution of:
Log_Global_Sales by Genre
- Each box represents:
- The median (center line)
- The interquartile range (IQR) for volatility
- The whiskers and outliers for extreme values
- The chart was saved for reporting and comparison.
Key Findings
-
Median Performance:
- Genres with a higher median line represent more reliable average sales.
-
Volatility (Risk Level):
- Genres with a wide box and long whiskers show:
- High variability
- High upside potential
- Higher financial risk
-
Genre Comparison:
- Some genres (such as Sports) tend to show:
- More stable and predictable performance
- Others (such as Role-Playing or Strategy) show:
- Larger spread
- Greater uncertainty and volatility
Conclusion
Sales performance varies significantly across genres. Understanding sales volatility by genre is essential for:
- Strategic production decisions
- Risk management
- Market targeting
This insight also provides valuable context for both regression and classification models.

Part 3: Baseline Regression Model – Linear Regression
Objective
The goal of this section is to build a baseline regression model in order to predict log-transformed global video game sales (Log_Global_Sales). This baseline will serve as a reference point to evaluate future model improvements.
Feature Engineering and Data Preparation
Game Age Creation
A new feature called Game_Age is created using the formula:
Part 3: Baseline Regression Model (Linear Regression)
Objective
The goal of this section is to build a baseline regression model to predict video game sales using the transformed target variable Log_Global_Sales. This baseline model serves as a reference point to evaluate future, more advanced models.
Feature Engineering & Data Preparation
Before training the model, several preprocessing steps were applied:
- A new feature Game_Age was created using the difference between the current year (2024) and the year of release.
- Rare categories in categorical variables were grouped into an "Other" category to reduce noise.
- Multicollinear and non-informative features such as regional sales, raw global sales, and release year were removed.
- All categorical variables were converted into numerical format using One-Hot Encoding.
- Numerical features were standardized using StandardScaler.
The dataset was then split into:
- 80% training set
- 20% test set
using a fixed random seed for reproducibility.
Model Training
A Linear Regression model was trained using the processed training data. This model provides a simple and interpretable approach to understand the linear relationship between the features and global sales.
Model Evaluation
The model was evaluated on the test set using several performance metrics:
- R² (coefficient of determination)
- RMSE (Root Mean Squared Error)
- MAE (Mean Absolute Error)
- MSE (Mean Squared Error)
These metrics allow an objective assessment of both prediction accuracy and error magnitude.
Model Insights & Interpretation
- A Predictions vs. Actual Values scatter plot was generated to visually assess the model’s performance.
- A feature importance analysis based on model coefficients highlighted the most influential variables.
- The presence of Game_Age among the top features confirms that even if its direct correlation is weak, it still adds predictive value to the model.
This baseline model establishes a solid reference for later improvements using more advanced machine learning techniques.


Part 4: Feature Engineering with K-Means Clustering
Objective
The objective of this section is to enrich the dataset by creating a new behavioral feature using clustering. K-Means is applied to group games with similar characteristics in terms of reviews, audience interaction, and age.
Features Used for Clustering
The following variables were selected to capture both quality and popularity signals:
- Critic_Score
- User_Score
- Critic_Count
- User_Count
- Game_Age
These features were standardized using StandardScaler to ensure equal influence during clustering.
Determining the Optimal Number of Clusters (Elbow Method)
To identify the optimal number of clusters, the Elbow Method was applied:
- K values from 1 to 10 were tested.
- For each K, the Sum of Squared Errors (SSE / Inertia) was computed.
- The SSE values were plotted to observe where the decrease starts to slow down.
The elbow in the curve clearly suggests an optimal value of:
K = 4 clusters
This value will be used in the next step to generate a new cluster-based feature that will be added to the dataset and later used in predictive modeling.

Key Benefit
This clustering-based feature allows the model to:
Part 4.2: Interactive K-Means Clustering with Slider
Objective
This section allows for interactive exploration of the clustering structure in the dataset using K-Means and PCA for visualization.
The goal is to visually inspect how different values of K impact the grouping of games, supporting the earlier choice of K=4.
Features Used
The clustering is based on the same features as in the previous step:
- Critic_Score
- User_Score
- Critic_Count
- User_Count
- Game_Age
These features are standardized to ensure equal contribution during clustering.
PCA for Visualization
- Principal Component Analysis (PCA) is applied to reduce the 5-dimensional feature space to 2 components.
- This allows plotting in 2D, preserving as much variance as possible.
- Each point represents a game, positioned according to its transformed features.
Interactive K-Means Exploration
- An interactive slider lets the user vary K from 2 to 10.
- For each K, the K-Means algorithm clusters the games, and results are plotted on the PCA-reduced 2D space.
- Each cluster is color-coded, enabling easy visual inspection of groupings and separations.
- The default value is K=4, based on the Elbow Method analysis from the previous section.
Key Benefits
- Allows dynamic evaluation of different cluster counts without rerunning the full notebook.
- Supports identification of stable clusters and potential outliers.
- Provides visual intuition for the new feature that will be added to the dataset (cluster IDs).
- Serves as a diagnostic tool before using cluster IDs in predictive models.

Part 4.3: Applying Clustering and Creating the New Feature
Objective
This step finalizes the K-Means clustering process and creates a new feature, Cluster_ID, which encodes games into groups based on critic scores, user scores, review counts, and game age.
The goal is to leverage cluster membership as a predictive feature for regression models.
Steps Overview
-
Data Preparation
- The same features used in Cells 4.1 and 4.2 are standardized:
Critic_Score
User_Score
Critic_Count
User_Count
Game_Age
- Standardization ensures all features contribute equally to clustering.
-
K-Means Clustering
- K = 4 clusters are chosen based on the Elbow Method (Cell 4.1).
- The K-Means algorithm is applied to the standardized features.
- Each game receives a
Cluster_ID label (0–3).
-
Feature Creation
Cluster_ID is added to the main DataFrame (df) as a categorical feature.
- This feature captures latent patterns in the dataset, combining quality, popularity, and age of games.
-
Visualization via PCA
- PCA reduces the 5-dimensional feature space to 2 components for plotting.
- Scatter plot shows how clusters are separated in the PCA-reduced space.
- Color-coding by
Cluster_ID visually confirms the distinctness of clusters.
-
Centroid Analysis
- Average feature values for each cluster are calculated to interpret cluster characteristics:
- High vs. low critic/user scores
- Popularity (review counts)
- Game age
- Provides insight into what differentiates each segment.
Key Insights
- The new feature
Cluster_ID now represents four distinct game segments based on performance, popularity, and recency.
- This feature is ready to be one-hot encoded and included in regression models to potentially improve predictive performance.
- PCA visualization confirms clusters are reasonably separated, supporting their use as meaningful predictors.

Part 4.4: Finalizing Feature Engineering - One-Hot Encoding of Cluster_ID
Objective
This step completes the feature engineering process by finalizing the dataset for modeling.
Specifically, the Cluster_ID feature created in Part 4.3 is now converted to a categorical variable and one-hot encoded, along with all other categorical features.
The resulting dataset df_final_encoded is ready for regression or other predictive modeling.
Steps Overview
-
Cluster_ID as a Categorical Feature
Cluster_ID initially is a numerical label (0, 1, 2, 3) from K-Means clustering.
- Converted to
object type to indicate it is nominal, not ordinal.
-
Dataset Preparation
- Columns that are obsolete or highly correlated (already used in transformed targets or counts) are dropped:
- Sales columns (
Global_Sales, NA_Sales, etc.)
- Original target columns (
Sales_Success)
Year_of_Release (game age is already captured in Game_Age)
- Score, count, and
Game_Age columns are retained as numerical features.
-
Handling Rare Categories
- For all categorical features (including
Cluster_ID, Genre, Platform):
- Categories with frequency < 1% are grouped into
Other_{col}.
- Ensures robustness and prevents high-dimensional sparsity in encoding.
-
One-Hot Encoding
- All categorical features are one-hot encoded.
- The
drop_first=True option is used to avoid multicollinearity.
- Numerical features remain untouched and scaled later as needed.
Key Outcome
df_final_encoded contains:
- Encoded categorical variables (
Cluster_ID, Genre, Platform, etc.)
- Numerical features (
Critic_Score, User_Score, Critic_Count, User_Count, Game_Age)
- Dataset is fully ready for model training (regression or classification).
Conclusion: The new feature Cluster_ID, representing game quality clusters, is now incorporated and encoded, providing additional predictive power for downstream modeling tasks.
Part 5: Train and Evaluate Three Improved Models
5.1 Final Data Preparation, Training, and Evaluation
Objective
This step evaluates three regression models on the fully engineered dataset (df_final_encoded) to predict Log_Global_Sales.
The goal is to assess the impact of feature engineering, particularly the new Cluster_ID feature, on model performance compared to the baseline Linear Regression.
Steps Overview
-
Final Dataset Preparation
- Features (
X) include:
- Numerical features:
Critic_Score, User_Score, Critic_Count, User_Count, Game_Age
- One-hot encoded categorical features:
Cluster_ID, Genre, Platform, etc.
- Target (
y) is Log_Global_Sales.
- Train/Test split: 80% training / 20% testing (seed = 42 for reproducibility).
- Scaling numerical features using
StandardScaler while leaving one-hot binary features untouched.
-
Model Training
- Three models are trained:
- Linear Regression (Improved) – baseline comparison with new features
- Random Forest Regressor – tree-based model capturing non-linear interactions
- Support Vector Regressor (SVR) – kernel-based model for non-linear regression
- Each model predicts on the test set.
-
Model Evaluation
- Metrics computed:
- R² (coefficient of determination)
- RMSE (root mean squared error)
- MAE (mean absolute error)
- Results are summarized in a comparison table.
-
Winner Declaration
- The model with the highest R² is declared the winner.
- Improvement over the baseline Linear Regression is calculated:
- Absolute increase in R²
- Percentage improvement
-
Feature Importance
- Top 10 features influencing the winning model are visualized:
- Linear Regression: standardized coefficients
- Random Forest: Gini-based feature importance
- Highlights which engineered features (e.g.,
Cluster_ID) contribute most.
Key Insights
-
Performance Gains:
- The improvement in R² demonstrates the value of feature engineering, particularly the addition of
Cluster_ID.
- Non-linear models (Random Forest or SVR) better capture complex interactions between scores, counts, and age.
-
Importance of Cluster_ID:
- Categorizes games by quality/popularity profile.
- Helps models distinguish "Extreme Blockbuster" games from typical releases.
- Reduces errors in predicting high-value sales.
-
Conclusion:
- Feature engineering and careful model selection significantly enhance predictive performance.
Cluster_ID proves to be a key feature for capturing hidden structure in game sales data.

Part 6: Winning Model
6.1 Export the Winning Model to a Pickle File
In this step, we finalize the winning regression model (identified in Part 5) and prepare it for deployment by exporting it to a pickle file.
1. Context Verification
- Before exporting, the notebook checks if the variables
winner and models exist.
- These variables must have been defined during the training and evaluation in Part 5.
- If they are missing, a warning is displayed, and execution stops to prevent exporting an undefined model.
2. Winning Model Identification
- The winning model is retrieved from the dictionary of trained models using the variable
winner.
- This ensures that the model exported is the best-performing model on the test set.
3. File Naming
- The exported model file is named:
vgsales_winning_regressor.pkl
- Using
.pkl (or .joblib) ensures compatibility for future loading and deployment in Python applications.
4. Export Process
- The model is saved to disk using
joblib.dump().
- If successful, a confirmation message is displayed.
- If there is any issue during export, an error message is shown with details.
Outcome:
The winning regression model is now safely stored as a Pickle file, ready for deployment or future predictions without retraining.
Part 7.1: Create Classification Target (Success_Tier) via Quantile Binning (75th Percentile)
In this step, we define the classification target for identifying commercial successes in video game sales.
1. Target Definition
- The new target variable is named
Success_Tier.
- It is derived from the original
Global_Sales column using quantile binning at the 75th percentile.
- Logic:
0 → Sales ≤ 75th percentile → "Standard" game
1 → Sales > 75th percentile → "Success" / "Blockbuster"
2. Context and Checks
- Before creating the target, the notebook checks if the original DataFrame
df exists in memory.
- If the final encoded DataFrame (
df_final_encoded) exists, the new Success_Tier column is also added there for use in classification modeling.
- Warnings are displayed if any of these data structures are missing to ensure reproducibility.
3. Rationale for Quantile Binning
- Using the 75th percentile ensures we focus on the top-performing games — i.e., the true commercial hits.
- This method is aligned with the business goal of identifying games that generate significant revenue, while separating them from standard performers.
Outcome:
The dataset now includes a binary classification target (Success_Tier), marking Blockbusters as 1 and standard games as 0.
This target will be used for training classification models in subsequent steps.
Part 7.1: Creating the Classification Target (Success_Tier) via Quantile Binning (75th Percentile)
In this step, we create the binary classification target to identify top-performing video games in terms of sales.
1. Target Definition
- The target variable is named
Success_Tier.
- It is derived from the
Global_Sales column using quantile binning at the 75th percentile.
- Logic:
0 → Sales ≤ 75th percentile → Standard game
1 → Sales > 75th percentile → Success / Blockbuster
2. Context Checks
- The notebook first verifies that the original DataFrame
df exists.
- If the final encoded DataFrame
df_final_encoded exists, the new target column is also added there to ensure it can be used directly for classification model training.
- Warnings are displayed if any of these required DataFrames are missing.
3. Reasoning for Quantile Binning
- Using the 75th percentile focuses the analysis on the top quartile of games, representing the true commercial hits.
- This approach aligns with the business goal of detecting games that generate significant revenue, separating them from standard performers.
Outcome:
- The dataset now contains the
Success_Tier column:
1 → Blockbuster / Success
0 → Standard
- This target will be used for training classification models in subsequent steps.
Part 7.2: Train/Test Split and Class Balance Check
In this step, we prepare the dataset for classification model training and evaluate the class distribution.
1. Defining Features and Target
- X → All encoded features, excluding the regression target (
Log_Global_Sales) and the classification target (Success_Tier).
- y_cls → The binary target column
Success_Tier (0: Standard, 1: Success).
2. Feature Scaling
- Numerical features are scaled using StandardScaler to ensure consistency across the dataset.
- Scaling helps models like KNN and SVM perform better.
3. Train/Test Split
- The dataset is split into 80% training and 20% testing.
stratify=y_cls ensures that the class imbalance (~75/25) is maintained in both sets.
- Outcome:
X_train_cls, X_test_cls, y_train_cls, y_test_cls.
4. Class Balance Analysis
- The training set class distribution is displayed:
- Class 0 (Standard): ~75%
- Class 1 (Success / Blockbuster): ~25%
- Visualization confirms that the minority class (Success) is properly represented.
5. Metric Justification
- Due to the class imbalance, Accuracy is not reliable.
- Key metrics for Class 1 (Success) are:
- Recall → Ensures we capture as many true Hits as possible, minimizing False Negatives (the most critical business error).
- F1-Score → Balances Recall and Precision for Class 1.
- This focus aligns with the business goal of identifying potential Blockbusters.

Part 8.1: Strategic Choices (Recall vs. Precision)
In this step, we define the evaluation strategy for the classification task, focusing on the business impact of errors.
1. False Positives (FP) vs. False Negatives (FN)
- In predicting game sales, the most critical error is a False Negative (FN):
- FP (False Positive): Model predicts Success (1), but the game is Standard (0).
- Business Impact: Investing in a game that underperforms. Loss is manageable.
- FN (False Negative): Model predicts Standard (0), but the game is a Success (1).
- Business Impact: Missing to market a Hit (Blockbuster). Loss is extremely critical, potentially millions in missed revenue.
Conclusion: Minimize False Negatives (FN) as they represent the largest potential profit loss.
2. Precision vs. Recall
- Precision: Measures reliability — of all predicted Successes, how many were truly hits.
- Recall: Measures coverage — of all true Hits, how many did we correctly capture.
Conclusion:
- Recall is the key metric for Class 1 (Success).
- The goal is to capture all possible Blockbusters, even if it introduces some acceptable False Positives, ensuring maximum detection of top-selling games.
Part 8.2: Training Three Classification Models
In this step, we define and train three different classification models to predict Success_Tier (Blockbusters).
1. Model Definitions
-
Logistic Regression
- Solver:
liblinear
- Class imbalance handled with
class_weight='balanced'
- Maximum iterations: 1000
-
K-Nearest Neighbors (K=5)
- Simple K-NN classifier with 5 neighbors
- Note: K-NN does not support
class_weight
-
Random Forest Classifier
- 100 trees, parallel processing enabled (
n_jobs=-1)
- Class imbalance handled with
class_weight='balanced'
All models are initialized with a fixed random seed for reproducibility.
2. Training Procedure
- Each model is trained on the training set (
X_train_cls, y_train_cls).
- Trained models are stored in the dictionary
trained_models_cls for evaluation in the next step.
NOTE: Using class_weight='balanced' ensures that minority class samples (Hits) are properly considered during training, which is critical due to the 75/25 class imbalance.
Part 8.3: Evaluation, Confusion Matrices, and Winner Selection
After training the classification models, we evaluate their performance with a focus on Class 1 (Success / Blockbusters).
1. Evaluation Metrics
For each model, we calculate:
- Accuracy – overall correctness of predictions
- Precision (Class 1) – proportion of predicted Successes that are truly Success
- Recall (Class 1) – proportion of true Successes correctly captured
- F1-Score (Class 1) – harmonic mean of Precision and Recall, balancing both
- Confusion Matrix – breakdown of True Positives, False Positives, True Negatives, and False Negatives
Note: Recall is especially important since False Negatives (missed Hits) are the most critical business errors.
2. Confusion Matrix & Error Analysis
- Each model’s confusion matrix is visualized using a heatmap.
- We specifically track False Negatives (FN), which represent missed Hits and thus lost revenue opportunities.
- This helps in identifying which model minimizes the most critical errors for the business.
3. Final Comparison & Winner Selection
- Models are compared using the F1-Score for Class 1 as the main criterion.
- The comparison table includes Accuracy, Recall, and F1-Score for easy reference.
Winner Model:
- The model with the highest F1-Score for Class 1 is selected as the best performing model and it's the Random Forest Classifier
- This model balances the need for high recall (capturing all Hits) while keeping acceptable precision.


Part 8.4: Winner Selection and Export
After evaluating the classification models, we identify the winning model and export it for deployment.
1. Verification and Winner Identification
- Ensure that the variables
winner_cls and trained_models_cls exist.
- The winning model is loaded from the
trained_models_cls dictionary using winner_cls as the key.
2. Model Export
- The winning classification model is exported to a file using
joblib.
- The filename used is:
vgsales_winning_classifier.pkl
The export confirms that the best model is now stored in a reusable format.
Conclusion
This project provided an end-to-end analysis of video game sales, from data exploration to regression and classification modeling.
Key Takeaways
- No strong linear correlations were found between individual features and global sales, suggesting that success is influenced by a complex combination of factors.
- The baseline Linear Regression model showed limited predictive power, highlighting the difficulty of modeling exact sales values.
- However, critic scores, user scores, and certain platform or publisher categories still displayed meaningful predictive importance.
- To better match business insights, we reframed the problem as a classification task by defining “Success” using the 75th percentile of global sales.
- This created a 75/25 class imbalance, making metrics such as Recall and F1-Score more relevant than accuracy.
- Classification models offered clearer, actionable insights into the key features associated with high-selling “blockbuster” titles.