【实例简介】
按照一定规则生成了1万男性 1万女性样本,模拟婚恋配对
【实例截图】
【核心代码】
# 匹配成功率计算
success_n = len(graphdata2)
success_chance = graphdata2.groupby(['type_m','type_f']).count().reset_index()
success_chance['chance'] = success_chance['m']/success_n
success_chance['alpha'] = (success_chance['chance'] - success_chance['chance'].min())/(success_chance['chance'].max() - success_chance['chance'].min())*8 # 设置alpha参数
success_chance.head()