python - 应用基于百分比值的随机生成器

标签 python machine-learning

我有一个电子表格,其中包含来自《实况足球》的 7000 名球员统计数据,我想根据他的位置获取每个属性的每个值的发生率百分比。

类似于:

Striker - Attack = 99: 1.3%; 98: 1.8%; 97: 3.5%;...

CenterBack - Attack = 99: 0.002%; 98: 0.003%; 97: 0.006%;...

然后我将根据此参数创建一个随机玩家生成器。

  • 所以我的问题是,我怎么会发生这种情况?
  • 我认为这是一个机器学习应用程序,我错了吗?
  • 那么,利用这个参数,有没有办法以百分比概率生成随机的东西?

最佳答案

直接回答你的问题:当你想知道某个分布的百分位数时,可以使用 numpy

import numpy as np
strikerAttackValueList=np.random.randint(0,100,1000)#example of stats list    
percentile50=np.percentile(strikerAttackValueList,50)

但这既是一个数学统计问题,也是一个编码问题。

第一步是检查实况足球中的值是如何分布的。这可能是正态的、均匀的……( https://en.wikipedia.org/wiki/List_of_probability_distributions ),具有一定的平均值和标准偏差。 要了解这一点,请导入您想要研究的统计数据并执行以下操作:http://www.insightsbot.com/blog/WEjdW/fitting-probability-distributions-with-python-part-1

然后,要生成随机玩家统计数据,您可以使用 random 或 numpy(示例假设 0 到 100 之间均匀分布):

import random
strikerAttackValue=random.randint(0,100)
print(strikerAttackValue)

import numpy as np
strikerAttackValue=np.random.randint(0,100)
print(strikerAttackValue)

关于python - 应用基于百分比值的随机生成器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54593197/

相关文章:

python - Pandas 数据帧 : SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame

python - 如何使用 python 的 bash 时间函数?

python - 将 scipy 稀疏 csr 转换为 Pandas ?

machine-learning - 自动编码器无法捕获小伪影

matlab - 机器学习: How can I include sensitivity or specificity in error calculation?

python - 从抽象类继承SQLAlchemy类时抛出异常: metaclass conflict: the metaclass of a derived class must be

python - 长度与数量

python - 从字典中的字典中获取键

machine-learning - 使用神经网络进行 OCR

R 预测缺失值