Comparing the contribution of NBA draft picks(转)

本文通过爬取1980-2014年NBA选秀数据,聚焦关键指标如选秀位置、大学背景、总比赛场次等,分析不同选秀位置的贡献、各选秀年的质量、球员的职业生涯长度,并列出各选秀位置的最佳球员。结果显示高顺位选秀往往对球队贡献更大,而某些低顺位球员表现突出。2008年选秀被认为是表现最佳的一年,而1984年和2003年则相对逊色。

 

When it comes to the NBA draft, experts tend to argue about a number of things: at which position will a player be selected? what is the best draft class ever? etc… Luckily, the wealth of data made available by the great people ofhttp://www.basketball-reference.com/draft/ make it possible to address a number of these, and other questions.

To begin, I started off by writing a quick Python script to scrape draft data for the time period of 1980-2014 (see at the end of this post for the source code, or on my GitHub). For the purpose of this analysis, I focussed on some key metrics that I deemed to be informative and useful enough to investigate further, which included:

  • Name of player (player)
  • College of drafted player (college)
  • Year of draft (draft_year)
  • Draft pick rank (rank)
  • Team that drafter the player (team)
  • Total games played (gp)
  • Total minutes played (mp)
  • Minutes per game (mpg)
  • Points per game (ppg)
  • Assists per game (apg)
  • Rebounds per game (rbg)
  • Win shares (ws)
  • Win shares per 48 minutes (ws_48)
  • Total years in league (yrs)

Once this was achieved, I began by measuring the respective contribution of each pick position during the period of 1980-2014. Here, I simply computed and normalized the median statistics for each pick position. Not too surprisingly, higher draft picks tend to be contribute more to their respective teams, although we do notice that some late 2nd round draft pick have high win shares per 48 numbers. It turns out that these correspond to the picks at which Kurt Rambis (57th) and Manu Ginobilli (58th) were picked…but more on this later

pick_performance
Next, I decided to estimate the quality of each draft year by measuring how players performed in comparison to players picked at the same rank during other years. I was somewhat surprised to discover that the draft crop of 2008 was the one with the highest win shares, although looking back at the players that participated at that draft,it makes a lot of sense! On the other hand, the vaunted draft class of 1984 (Olajuwon, Barkley, Jordan) and 2003 (James, Anthony, Wade, Bosh) did not fare as well, which may be attributable to the fact that these included more elite players, but were far less deep in the lower picks of the draft.
draft_year_performance
Next, I looked at the longevity of each draft pick, in other words how long each draft pick is expected to remain in the NBA league, which can be achieved by using survival curves. Not too surprisingly, higher draft picks are much more likely to stay longer in the league. As a general observation, this also means that NBA teams are quite proficient at selecting the right players at the right position.

pick_survival_curve

At this point, we can examine the relative performance of NBA teams with regards to their drafting skills. To do this, I compared the performance of each player compared to the average performance of other players drafted at the same position, computed the respective ratios, and summed these up for each NBA team. This analysis revealed that the top 5 drafting teams were Detroit Pistons, Cleveland Cavaliers, Memphis Grizzlies, Phoenix Suns and the San Antonio Spurs (I purposely ignored the Brooklyn Nets and the New Orleans Hornets because of the small number of years these two teams have been in the league.)

team_draft_ranking

Finally, I decided to look for the best players picked at each position. Again, I compared each player’s career stats to the average numbers obtained by other players picked at the same position. For display purposes, I only show the top three players at each pick position, although you can easily reproduce the results by re-running my code here. (At this point, I should take the opportunity to advertise the great stargazerR package, which allows to quickly output R objects into LaTex or HTML tables). The results I obtained made a lot of sense, and I was very interested to learn that even at pick position 13, Kobe Bryant was only the 2nd best pick, as he was outnumbered by none other than the Mailman himself (i.e. Karl Malone). Of course, this analysis only considers numbers as opposed to achievements and trophies, but I think it is still amusing to find that Kobe Bryant isn’t even the most productive player at his position.

 Best pick2nd best pick3rd best pick
1LeBron JamesJohn WallAllen Iverson
2Isiah ThomasJason KiddGary Payton
3Michael JordanDeron WilliamsPau Gasol
4Chris PaulRussell WestbrookStephon Marbury
5Charles BarkleyDwyane WadeKevin Garnett
6Damian LillardBrandon RoyAntoine Walker
7Kevin JohnsonStephen CurryAlvin Robertson
8Andre MillerClark KelloggDetlef Schrempf
9Dirk NowitzkiTracy McGradyAndre Iguodala
10Paul PierceBrandon JenningsPaul George
11Fat LeverMichael Carter-WilliamsTerrell Brandon
12Mookie BlaylockMuggsy BoguesJohn Bagley
13Karl MaloneKobe BryantSleepy Floyd
14Tim HardawayClyde DrexlerPeja Stojakovic
15Steve NashAl JeffersonGary Grant
16John StocktonNikola VucevicMetta World Peace
17Jrue HolidayJosh SmithShawn Kemp
18Mark JacksonTy LawsonJoe Dumars
19Rod StricklandZach RandolphJeff Teague
20Larry NanceJameer NelsonPaul Pressey
21Rajon RondoDarren CollisonMichael Finley
22Scott SkilesReggie LewisKenneth Faried
23Tayshaun PrinceA.C. GreenWilson Chandler
24Sam CassellKyle LowryArvydas Sabonis
25Jeff RulandMark PriceNicolas Batum
26Vlade DivacKevin MartinGeorge Hill
27Dennis RodmanJamaal TinsleyJordan Crawford
28Tony ParkerSherman DouglasGene Banks
29Toni KukocJosh HowardP.J. Brown
30Gilbert ArenasNate McMillanDavid Lee
31Doc RiversDanny AingeNikola Pekovic
32Rashard LewisBrent PriceLuke Walton
33Grant LongDirk MinniefieldSteve Colter
34Carlos BoozerMario ChalmersC.J. Miles
35Mike IuzzolinoDeAndre JordanDerek Smith
36Clifford RobinsonErsan IlyasovaOmer Asik
37Nick Van ExelMehmet OkurJeff McInnis
38Chandler ParsonsChris DuhonSteve Blake
39Rafer AlstonEarl WatsonKhris Middleton
40Monta EllisDino RadjaLance Stephenson
41Cuttino MobleyPopeye JonesOtis Smith
42Stephen JacksonPatrick BeverleyMatt Geiger
43Michael ReddEric SnowTrevor Ariza
44Chase BudingerMalik RoseCedric Henderson
45Goran DragicHot Rod WilliamsAntonio Davis
46Jeff HornacekJerome KerseyVoshon Lenard
47Paul MillsapMo WilliamsGerald Wilkins
48Marc GasolMicheal WilliamsCedric Ceballos
49Andray BlatcheHaywoode WorkmanKyle O’Quinn
50Ryan GomesPaul ThompsonLavoy Allen
51Kyle KorverJim PetersenLawrence Funderburke
52Fred HoibergAnthony GoldwireLowes Moore
53Anthony MasonTod MurphyGreg Buckner
54Sam MitchellShandon AndersonMark Blount
55Luis ScolaKenny GattisonPatrick Mills
56Ramon SessionsAmir JohnsonJoe Kopicki
57Manu GinobiliMarcin GortatFrank Brickowski
58Kurt RambisDon ReidRobbie Hummel
59NANANA
60Isaiah ThomasDrazen PetrovicRobert Sacre

As usual, all the code for this analysis can be found on GitHub account.

CAVEATS

With regards to the analysis shown above, it is important to highlight a few potential caveats:

    • I worked with career averages, which somewhat ignores the years of peak performance achieved by certain players. However, I feel it that career averages are a reasonably good proxy for overall player competence.
    • I completely ignored the fact that some teams had more opportunities to select higher draft picks than others (cough…Cleveland…cough). As such, there may be a bias towards historically bad teams that would have been in the top 5 picks more often than others. However, I did compare each player to others that were picked at the same position, some hopefully this will bypass the issue (for example, if a team had plenty of NO 1 picks that were bad compared to other NO 1 picks, this insight will be revealed in the analysis)

转自:https://statofmind.wordpress.com/2015/01/26/comparing-the-contribution-of-nba-draft-picks/

 

转载于:https://www.cnblogs.com/payton/p/4251965.html

### 使用 `Comparator.comparing` 实现类型换 在 Java 中,`Comparator.comparing()` 提供了一种简洁的方式来基于特定属性或函数创建比较器。该方法接受一个函数作为参数,此函数定义了要提取并用于比较的关键字段[^1]。 #### 基本语法 以下是 `Comparator.comparing` 的基本形式: ```java public static <T, U extends Comparable<? super U>> Comparator<T> comparing(Function<? super T, ? extends U> keyExtractor) ``` 其中,`keyExtractor` 是一个函数接口,通常通过 lambda 表达式或方法引用提供,用于从对象中提取可比较的键值。 当需要进行类型换时,可以通过自定义 `Function` 来完成这一过程。下面是一个具体的例子: --- #### 示例代码:字符串长度排序 假设有一个类 `Person`,我们希望按照名字的长度对其进行排序。 ```java import java.util.*; import java.util.function.Function; import java.util.Comparator; class Person { private String name; public Person(String name) { this.name = name; } public String getName() { return name; } @Override public String toString() { return "Person{name='" + name + "'}"; } } public class Main { public static void main(String[] args) { List<Person> people = Arrays.asList( new Person("Alice"), new Person("Bob"), new Person("Christopher") ); // 按照名字长度升序排列 people.sort(Comparator.comparing(person -> person.getName().length())); System.out.println(people); } } ``` 上述代码展示了如何使用 `Comparator.comparing` 将 `String` 换为其长度(即整数)来实现排序。 --- #### 处理复杂场景:多级排序与类型换 如果需要进一步扩展功能,可以结合 `.thenComparing` 方法处理多个级别的排序逻辑。例如,在按年龄排序的基础上再按姓名降序排列: ```java List<Person> people = Arrays.asList( new Person("John", 25), new Person("Jane", 30), new Person("Doe", 25) ); // 首先按年龄升序,其次按名称降序 people.sort(Comparator.comparing(Person::getAge).thenComparing( Comparator.comparing((Person p) -> p.getName().toLowerCase(), Comparator.reverseOrder()) )); System.out.println(people); ``` 这里,`.thenComparing` 接收另一个比较器实例,允许我们在第一次比较相等的情况下应用额外的规则[^3]。 --- #### 双精度浮点数类型的排序 对于双精度浮点数值的排序,可以直接利用专门的方法 `comparingDouble` 或者手动传递映射函数给 `comparing`。例如: ```java class Student { private double percentageMarks; public Student(double percentageMarks) { this.percentageMarks = percentageMarks; } public double getPercentageMarks() { return percentageMarks; } @Override public String toString() { return "Student{percentageMarks=" + percentageMarks + "}"; } } public class Main { public static void main(String[] args) { List<Student> students = Arrays.asList( new Student(78.9), new Student(85.6), new Student(78.9) ); // 方式一:使用 comparingDouble students.sort(Comparator.comparingDouble(Student::getPercentageMarks)); // 方式二:使用 comparing 并显式指定 Double 类型 students.sort(Comparator.comparing(student -> student.getPercentageMarks())); System.out.println(students); } } ``` 两种方式均能正常工作,但推荐优先考虑专用方法如 `comparingInt`, `comparingLong`, 和 `comparingDouble`,因为它们性能更优且语义清晰[^4]。 --- ### 总结 `Comparator.comparing` 不仅简化了基于单个属性的排序操作,还支持复杂的类型换以及链式的多重条件排序。开发者只需关注核心业务逻辑——即如何抽取待比较的数据即可。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值