我请求帮助从 scipy 库导入 frechet_r 函数

问题描述 投票:0回答:1

当我尝试将函数导入库时,出现以下错误

from scipy.stats import frechet_r
ImportError: cannot import name 'frechet_r' from 'scipy.stats' (C:\Users\melqu\anaconda3\lib\site-packages\scipy\stats\__init__.py)

我尝试按如下方式调用该函数

from scipy.stats import frechet_r

这种导入方式正确吗?

我已经尝试卸载并重新安装 scipy、更新 pip 以及其他建议

python scipy scipy.stats
1个回答
0
投票

发行版

frechet_r
frechet_l
已从 1.6.0 版本中的 SciPy 中删除。

它们因令人困惑而被删除。

frechet_r
函数是 Weibull 分布的实现,历史上称为 Frechet 分布。

SciPy 问题 #3258 解释:

scipy.stats.distributions 中的文档和代码声明以下等价物:

weibull_max == frechet_l
weibull_min == frechet_r

但这是一个错误,事实上 Frechet 分布的指定是错误的。

[...]

我想我明白发生了什么:_continuous_distns.py 中的注释表明 原作者正在研究“Regress+”文档。 A 谷歌搜索指向 http://www.causascientia.org/math_stat/Dists/Compendium.pdf

“Regress+”文档提供了(正确的)描述 Weibull 分布,但不是 Frechet 分布。然而,在 作者对威布尔分布的注释写道:“威布尔 分布有时称为 Frechet 分布。”这种说法 Johnson-Kotz-Balakrishnan (1994; v. 1 p. 628) 证实了这一点,但他们 明确这只是历史用法。

为了解决这个问题,做了三件事:

  1. frechet_r
    已重命名为
    weibull_min
  2. frechet_l
    已重命名为
    weibull_max
  3. 创建了一个新函数
    invweibull
    。该分布实现了“Frechet 分布”的更常见含义。

要替换它们,您可以使用这三个函数之一,具体取决于您想要的行为。

© www.soinside.com 2019 - 2024. All rights reserved.