Skip to content

jovanvasic-codes/nba-rivalry-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trash talk has always been a part of NBA culture — from iconic rivalries to viral social-media moments. But one question rarely gets answered analytically:

Does trash talk actually change how players perform — in the moment, in the days after, or in the games that follow?

This project transforms narrative beefs, media controversies, player-to-player conflicts, and rivalry moments into quantifiable data.

It blends basketball psychology, storytelling, advanced statistics, and real NBA game logs to uncover how emotions, ego, and public narratives shape performance on the court.

🏀 NBA Trash Talk Impact Analysis

A multi-scenario analytics project exploring how NBA beefs, conflicts, and narrative moments influence on-court and off-court player performance.


💡 Overview

This project analyzes whether NBA trash talk, beefs, conflicts, and rivalry moments have a measurable impact on player performance.

Using a custom-processed dataset extracted from narrative descriptions, the analysis evaluates five distinct scenarios:

  • Scenario A: In-game impact
  • Scenario B: Short-term performance impact (Before/After)
  • Scenario C: Off-court narrative momentum
  • Scenario D: Internal team conflict effects
  • Scenario E: Rivalry duels and head-to-head behavior

This is a full data analysis case study designed as a portfolio project, featuring a complete preprocessing pipeline, custom feature extraction, visual analytics, and scenario-based conclusions.


🚀 Installation & How to Run

  1. Clone the repository:

    git clone [https://github.com/yourusername/nba-trash-talk-project.git](https://github.com/yourusername/nba-trash-talk-project.git)
    cd nba-trash-talk-project
  2. Create environment:

    pip install -r requirements.txt
  3. Set up API keys:

    • Rename: env_example/env.example.env
    • Fill in your OpenAI API key:
      OPENAI_API_KEY=YOUR_KEY_HERE
      
  4. Launch JupyterLab:

    jupyter lab

    Open the notebooks in /notebooks and run them sequentially.


📊 Data Pipeline

Raw Narrative Dataset

  • beef_raw_descriptions: Contains paragraph-style descriptions of NBA beefs, trash talk moments, altercations, team drama, and media-driven conflicts.

Parsing & Classification

  • 01_parse_beef_paragraphs.ipynb extracts:
    • Player names, conflict dates, and event types
    • Teams involved and narrative context
  • 02_classify_beef_events.ipynb assigns each event to one of the five scenarios based on narrative cues, keywords, temporal context, and type of interaction (player-player, internal team, public beef, etc.).

Scenario-Specific Datasets

The resulting files used for analysis include:

  • beefs_scenario_A_in_game_impact.xlsx
  • beefs_scenario_B_short_term_performance.xlsx
  • beefs_scenario_C_off_court_narrative.xlsx
  • beefs_scenario_D_internal_team_conflict.xlsx
  • beefs_scenario_E_rivalry_duel.xlsx (...and several derived metric files.)

Anchor Game Alignment (Scenario B & E)

A key utility, find_anchor_game_and_windows(player, beef_date, window_size), aligns each beef event with:

  • The closest NBA game
  • $N$ previous games (window before)
  • $N$ next games (window after)

The inspect_anchor_for_row() utility is used to debug alignment quality.


🎯 Scenario Breakdown & Key Findings

Scenario A — In-Game Impact

  • Goal: Evaluate player performance in the same game where the beef happened.
  • Metrics analyzed: Points, assists, rebounds, Usage rate, Game Score, and Delta vs. baseline seasonal averages.
  • Main takeaway: Some players respond with short-term spikes in aggression, but performance delta was often negligible. In-game beefs rarely produce meaningful statistical changes.

Scenario B — Short-Term Performance Impact

  • Goal: Measure performance changes in the games immediately before and after the beef event.
  • Approach: Anchored game alignment (prev/next windows), short-term deltas, and dumbbell plots.
  • Key finding: Receivers of trash talk often win more despite slight performance declines. Initiators frequently experience frustration, leading to noticeable performance drops. This produced one of the strongest storytelling insights of the project.

Scenario C — Off-Court Narrative Momentum

  • Goal: Analyze "off-court moments" (interviews, media beefs, etc.) and connect them with performance momentum curves.
  • Techniques: Momentum score calculation, heatmap of positivity/negativity.
  • Notable finding: Some massive performance swings aligned exactly with well-known media events (e.g., public criticism, viral interviews). Heatmaps clearly showed negative dips aligning with controversial moments.

Scenario D — Internal Team Conflict

  • Goal: Examine conflicts within the same team and assess their effect on the conflicted player and overall team performance.
  • Findings: Several team conflicts resulted in noticeable drops in momentum and short-term performance. Visualizations confirmed narrative descriptions of mismatched expectations between teammates.

Scenario E — Rivalry Duels

  • Goal: Analyze head-to-head rivalry matchups and how conflicts affect their next encounters.
  • Findings: Some rivalries showed consistent patterns where one player improves after conflict, while the other declines. These results supported deeper storytelling used throughout the project.

📈 Visualizations

Each scenario contains dedicated notebooks with:

  • Histograms and momentum curves
  • Heatmaps and dumbbell plots
  • Comparative tables and anchor-window visual checks

(Plots are generated but stored in ignored folders (outputs/ and plots/) to keep the repository clean.)


✅ Project Conclusions

Across all scenarios, the project shows several key insights:

  1. Trash talk effects vary dramatically by personality type.

    • Some players thrive under pressure or conflict.
    • Others lose momentum, especially in rivalry or public narrative cases.
  2. Receiver vs. Initiator asymmetry.

    • Receivers often maintain or increase win rates and show stable stats.
    • Initiators sometimes overreact, force shots, and drop in efficiency. This strongly supports the storytelling angle introduced in Scenario B.
  3. Off-court events matter.

    • Certain media events correlated strongly with momentum dips, confirming that narrative and psychology intertwine with performance.
  4. Rivalries shape performance trails.

    • Head-to-head patterns reveal long-term narrative effects not visible in single games.

Data + Narrative Approach Produces Richer Insights

The project intentionally blends: structured NBA data, narrative descriptions, scenario modeling, and psychometric interpretations. The result is a unique portfolio case study showcasing multi-angle reasoning.

About

Multi-scenario analysis of how NBA trash talk and conflicts affect player performance

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published