{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "1y9e3ePnUpPg" }, "source": [ "# Example - Vector Recommendations With NBA Players" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "Qv1cp6gtUpPh" }, "source": [ "With the growth of the NBA quickly introducing new way to calculate statistics that are human-calculated, it doesn't make much sense to keep this using traditional human-orientated approaches and judgements based on players. \n", "\n", "Here, we want to be able to identify players that have similar statistics to other players without having to look at each statistic line by line. We want to just know. \n", "\n", "Below, we investigate the different players and their most similar counterparts as well as examine the efficiencies between the different players." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "colab": {}, "colab_type": "code", "id": "Blwr8CLDUpPi", "nbsphinx": "hidden" }, "outputs": [], "source": [ "%%capture\n", "!pip install xlrd\n", "!pip install drive/My\\ Drive/vecdb-python/.\n", "!pip install appdirs\n", "!pip install transformers" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "nbsphinx": "hidden" }, "outputs": [], "source": [ "import pandas as pd\n", "pd.set_option('display.max_columns', 100)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "nba_per_36 = pd.read_excel('data/nba_per_36.xlsx', skiprows=[0])\n", "nba_per_game = pd.read_excel('data/nba_per_game.xlsx')" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | FULL NAME | \n", "TEAM | \n", "POS | \n", "AGE | \n", "GP | \n", "MPG | \n", "MIN%Minutes PercentagePercentage of team minutes used by a player while he was on the floor | \n", "USG%Usage RateUsage rate, a.k.a., usage percentage is an estimate of the percentage of team plays used by a player while he was on the floor | \n", "Tor%Turnover RateA metric that estimates the number of turnovers a player commits per 100 possessions | \n", "FTA | \n", "FT% | \n", "2PA | \n", "2P% | \n", "3PA | \n", "3P% | \n", "eFG%Effective Shooting PercentageWith eFG%, three-point shots made are worth 50% more than two-point shots made. eFG% Formula=(FGM+ (0.5 x 3PM))/FGA | \n", "TS%True Shooting PercentageTrue shooting percentage is a measure of shooting efficiency that takes into account field goals, 3-point field goals, and free throws. | \n", "PPGPointsPoints per game. | \n", "RPGReboundsRebounds per game. | \n", "TRB%Total Rebound PercentageTotal rebound percentage is estimated percentage of available rebounds grabbed by the player while the player is on the court. | \n", "APGAssistsAssists per game. | \n", "AST%Assist PercentageAssist percentage is an estimated percentage of teammate field goals a player assisted while the player is on the court | \n", "SPGStealsSteals per game. | \n", "BPGBlocksBlocks per game. | \n", "TOPGTurnoversTurnovers per game. | \n", "VIVersatility IndexVersatility index is a metric that measures a player’s ability to produce in points, assists, and rebounds. The average player will score around a five on the index, while top players score above 10 | \n", "ORTGOffensive RatingIndividual offensive rating is the number of points produced by a player per 100 total individual possessions. | \n", "DRTGDefensive RatingIndividual defensive rating estimates how many points the player allowed per 100 possessions he individually faced while staying on the court. | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
151 | \n", "Angel Delgado | \n", "Lac | \n", "C | \n", "24.39 | \n", "2 | \n", "7.4 | \n", "15.4 | \n", "16.8 | \n", "0.0 | \n", "2 | \n", "0.500 | \n", "5 | \n", "0.200 | \n", "0 | \n", "0.000 | \n", "0.200 | \n", "0.255 | \n", "1.5 | \n", "2.0 | \n", "14.3 | \n", "0.0 | \n", "0.0 | \n", "0.50 | \n", "0.00 | \n", "0.00 | \n", "0.0 | \n", "79.2 | \n", "98.9 | \n", "
587 | \n", "John Wall | \n", "Was | \n", "G | \n", "28.60 | \n", "32 | \n", "34.5 | \n", "71.9 | \n", "28.8 | \n", "16.3 | \n", "175 | \n", "0.697 | \n", "382 | \n", "0.508 | \n", "169 | \n", "0.302 | \n", "0.491 | \n", "0.528 | \n", "20.7 | \n", "3.6 | \n", "5.7 | \n", "8.7 | \n", "39.2 | \n", "1.53 | \n", "0.91 | \n", "3.81 | \n", "10.0 | \n", "104.1 | \n", "111.5 | \n", "