使用 ambhas 包的问题:统计模块没有 cpdf 属性

Problems using ambhas package: statistics module has no cpdf attribute

我正在尝试将 ambhas 包用于 copula 和方法

 foo.generate_xy() 

不工作。

这是我得到的错误:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    generate()
  File "C:/Users/Mypc/Desktop/sfsdf.py", line 19, in genera
    x1,y1 = foo.generate_xy()
  File "C:\Python33\lib\site-packages\ambhas\copula.py", line 179, in     generate_xy
    self._inverse_cdf()
  File "C:\Python33\lib\site-packages\ambhas\copula.py", line 256, in  _inverse_cdf
    x2, x1 = st.cpdf(self.X, kernel = 'Epanechnikov', n = 100)
AttributeError: 'module' object has no attribute 'cpdf'

基本上我检查了 ambhas 模块中的代码,结果发现它正在尝试使用统计模块中的方法(作为 st 导入),st.cpdf() 我的统计中没有模块。

我该如何解决这个问题?

这是一个代码工作的例子。这与我试图通过 generate() 函数 运行 的代码完全相同: https://code.google.com/p/ambhas/wiki/Cookbook

A​​MBHAS 代码依赖 this statistics module, not the "official" one that is now included in Python 3.4. Unfortunately, the module doesn't appear to have been updated in a while, and the latest Windows installer is for Python 3.2, so you'll need to build it from source. You can do this with Cygwin, or by installing Visual C++ 2010 Express (here 是一个博客 post 描述过程,但我自己没有尝试过所以我不知道它是否完全准确 - YMMV)。

编译扩展后,请确保删除之前安装的 statistics 模块 运行 python setup.py install.