champAnalysis.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:lol_champ_recs 作者: Cpierse 项目源码 文件源码
def t_test_ex(role1,champ1,single_counts=False):
    champ1=str(champ2id[champ1])
    for role2 in recs[tier][role1][champ1]:
        if role2=='TOTAL' or role2=='DATA': 
            continue
        for idx in range(1,4):
            values = []
            for pos_to_compare in range(idx+1,idx+4):
                # Get ids from recs:
                champ2_1 = champ2id[recs[tier][role1][champ1][role2][idx]['champ']]
                champ2_2 = champ2id[recs[tier][role1][champ1][role2][pos_to_compare]['champ']]
                # Get data:
                N = recs[tier][role1][champ1][role2]['N']
                data = sliding_count_recs[tier][role1][champ1][role2]
                champ2_1_data = np.array(data['DATA'][champ2_1] + [0]*(N-len(data['DATA'][champ2_1])))
                champ2_2_data = np.array(data['DATA'][champ2_2] + [0]*(N-len(data['DATA'][champ2_2])))
                if single_counts:
                    champ2_1_data[champ2_1_data>0]=1
                    champ2_2_data[champ2_2_data>0]=1
                values.append(str(ttest_ind(champ2_1_data,champ2_2_data,equal_var=False)[1]))
            print( role2 + ' ' + id2champ[champ2_1] + ' p-values: ' +  values[0] + ', ' + values[1] + ', ' + values[2])
        print('-----------------------------------------------------------------------------')

#t_test_ex('TOP','Darius')
#t_test_ex('TOP','Darius',single_counts=True)
#
#t_test_ex('MID','Lux')
#t_test_ex('MID','Lux',single_counts=True)
#
#t_test_ex('ADC','Caitlyn')
#t_test_ex('ADC','Caitlyn',single_counts=True)
#
#
#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号