Exemple #1
0
       (lg_stats[1] - lg_stats[9] + lg_stats[15] + 0.44 * lg_stats[7]) /
       lg_games / 2)
 lgsum, lgames, lgmax, lgmin = 0, 0, [0, []], [30, []]
 for pm in tqdm(pms):
     if ss in enforce['Turnover'][pm][i][-1]:
         pmdir = playerMarkToDir(pm, RoF[i])
         if pmdir:
             plyr = Player(pm, RoF[i])
             ssgms = plyr.getSeason(ss)
             num_games = ssgms.shape[0]
             if num_games >= games_td[i]:
                 mpsum, scoresum = MPTime('0:00'), 0
                 for g in range(num_games):
                     sgm = ssgms[g:g + 1]
                     mp = MPTime(sgm['MP'].values[0])
                     if mp.mf() != 0:
                         # ================ 球员单场数据准备 ================
                         mpsum += mp
                         pts = float(sgm['PTS'])
                         fta, ft, fga, fg, tpa, tp = float(
                             sgm['FTA']), float(sgm['FT']), float(
                                 sgm['FGA']), float(sgm['FG']), float(
                                     sgm['3PA']), float(sgm['3P'])
                         drb, orb, trb = float(sgm['DRB']), float(
                             sgm['ORB']), float(sgm['TRB'])
                         ast, stl, blk, tov, pf = float(
                             sgm['AST']), float(sgm['STL']), float(
                                 sgm['BLK']), float(sgm['TOV']), float(
                                     sgm['PF'])
                         # ================ 球员本队数据准备 ================
                         gm = sgm['Playoffs' if i else 'Date'].values[0]
Exemple #2
0
                 # ================ 分项计算 ================
                 pts_ = pts
                 orb_ = orb * plus_minus[4]
                 drb_ = drb * (1 - op_drbp) * op_vop
                 ast_ = ast * plus_minus[3]
                 stl_ = stl * plus_minus[0]
                 blk_ = blk * plus_minus[2] * op_sp
                 tov_ = -tov * plus_minus[1]
                 # pf_ = - pf * op_stats[6] / tm_stats[16]
                 # bmiss_ = - tm_vop * tm_drbp * bmiss
                 # ================ 综合数据值 ================ 改进:1 投篮效率完全没有考虑!!!  2 盖帽需考虑对手命中率
                 # score = pts_ + drb * 0.45 + orb * plus_minus[4] + ast_ + stl * plus_minus[0] + blk * plus_minus[2] * 0.4 - tov * plus_minus[1] - pf * 1.2 - \
                 #         fmiss * 0.6 - 2 * bmiss * 0.36 - 3 * tmiss * 0.25
                 score = pts_ + drb_ + orb_ + ast_ + stl_ + blk_ + tov_
                 # score = pts + orb * orb_plus + ast * ast_plus + stl * stl_plus + blk * blk_plus - tov * tov_minus - pf * 2 - fmiss - 2 * bmiss - 3 * tmiss
                 score = score / mp.mf()
                 score *= (lg_pace / tm_pace)
                 lgsum += score
                 lgames += 1
                 if mp.mf() > 15:
                     if score > lgmax[0]:
                         lgmax[0] = score
                         lgmax[1] = [pm2pn[pm], ss]
                     if score < lgmin[0]:
                         lgmin[0] = score
                         lgmin[1] = [pm2pn[pm], ss]
                 # print(pm, num_games, score)
                 tmp[pm] = score
 # print(tmp)
 lg_ascore = np.mean(np.array(list(tmp.values())))
 print('联盟平均:', lg_ascore)