方法“fixation_probabilities”在 Nashpy 库中找不到

发布于 2025-01-14 07:13:15 字数 625 浏览 3 评论 0 原文

我正在尝试使用莫兰过程获得注视概率。

我已从该网站复制了示例(https:// /nashpy.readthedocs.io/en/stable/how-to/obtain-fixation-probabilities.html),但将其更改为我的矩阵和初始总体,但出现错误

np.random.seed(0)
repetitions = 2000
initial_population = (10,0)
A = np.array([[1, 2], [2, 1]])
game = nash.Game(A)
probabilities = game.fixation_probabilities(initial_population= (10,0), repetitions = 2000)
probabilities

并出现此错误:

“Game”对象没有属性“fixation_probabilities”

我该如何解决这个问题?

I am trying to obtain the fixation probabilities using Moran process.

I have copied the example from this website (https://nashpy.readthedocs.io/en/stable/how-to/obtain-fixation-probabilities.html) but changed it to my matrix and initial population but getting an error come up

np.random.seed(0)
repetitions = 2000
initial_population = (10,0)
A = np.array([[1, 2], [2, 1]])
game = nash.Game(A)
probabilities = game.fixation_probabilities(initial_population= (10,0), repetitions = 2000)
probabilities

and get this error:

'Game' object has no attribute 'fixation_probabilities'

How can I solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

追星践月 2025-01-21 07:13:15

您正在寻找的函数是 nashpy.game.Game https://nashpy.readthedocs.io/en/stable/reference/source/nashpy.html?highlight=Game#nashpy.game.Game

尝试使用 game = nash.game.Game (一)

The function you are looking for is nashpy.game.Game https://nashpy.readthedocs.io/en/stable/reference/source/nashpy.html?highlight=Game#nashpy.game.Game

Try with game = nash.game.Game(A)

寂寞花火° 2025-01-21 07:13:15

Nashpy 版本 fixation_probabilities 方法>0.0.27

它需要 Python 3.8。如果您使用 pip 和 Python 3.8 安装 Nashpy,那么您当前已经获得了 0.0.30 版本。

当使用 pip 和 Python 3.7 安装 Nashpy 时,您只能获得版本 0.0.21,因此您应该将 Python 版本升级到 3.8。

The method fixation_probabilities was added in Nashpy version 0.0.27.

It requires Python 3.8. If you install Nashpy using pip with Python 3.8 you are currently already getting version 0.0.30.

When installing Nashpy using pip with Python 3.7 you only get version 0.0.21, so you should upgrade your Python version to 3.8.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文