Blogs

Stop the ball in transition

June 3, 2017

Just seconds before you finished your spectacular dribbling showcase, barely left defender behind your back and tried that wild shot which was perfect, beside the fact that ball bricked the glass and your teammates had no chance to rebound it, since all of them were waiting for a pass on the weakside. Shooters have short memory, they say. Now you are running back on defense, turning around and seeing 7 feet of Kevin Durant approaching a bit too fast with the ball. ... Read more …

NBAr - scrape NBA data from NBA.com API

May 5, 2017

NBAr There was never a better time to be NBA, R and data analysis fan. Might be not the most useful tool nor the most exciting, but NBAr contains set of wrapper functions for downloading and simple processing of data from http://stats.nba.com API. Over the last year functions contained in NBAr package helped my write my master thesis and also couple of blog posts on this site. Before I finally start writing more frequently I decided to finish the package and upload it on github so everyone can see it, use it, give feedback or contribute. ... Read more …

DBSCAN approach to finding outliers among players

November 18, 2016

Although DBSCAN creates clusters on big and noticeably divided datasets I use it here mainly to find outliers among all players. That means it would distinguish all-stars players or those on the other side of NBA rankings. Luckily, it was the first one. library(factoextra) library(fpc) library(readr) library(dplyr) library(tidyr) library(tibble) players <- read_rds("../../data/dbscan/players.RDS") %>% remove_rownames() %>% column_to_rownames(var = 'PLAYER_NAME') dbs <- fpc::dbscan(players, eps = 4 ,MinPts = 200, scale= TRUE, method = 'raw') fviz_cluster(dbs, players, stand = FALSE, ellipse = FALSE, geom = "text",labelsize = 5) + theme_bw() + theme(legend. ... Read more …

TSNE approach to player clustering

November 18, 2016

TSNE was in fact my first idea for this task, because I wanted to reduce the dimensility of dataset, in which majority of attributes must be somehow correlated with each other. The first time I saw example of TSNE usage was on r-bloggers.com in pokemon visualition post, written by Joshua Kunst. So I basically treated NBA players as they were Pokemon… Actually It enabled me to reduce number of dimensions from 25 to 2 and therefore visualize all players on one chart. ... Read more …

Treemap of all players

November 17, 2016

Look at this beauty! Players in treemap

Clustering players by offensive style of play

November 15, 2016

My main goal of NBA analysis has always been and probably always will be trying to predict how any player would play against any team on any particular day of regular season. I am sure that building such a model would not be succesful without getting to know and then classyfing the players themselves before taking the next step. The main objective of this particular clustering is to find differences in style of play on the offensive end of the floor between NBA players. ... Read more …