java - 使用JEP在java中运行python代码
问题描述
我正在尝试使用JEP在 java中运行这个 python 库。我使用以下代码将参数发送到 python。
NDArray<int[]> r = new NDArray<>(twf, 1, twf.length);
NDArray<int[]> d = new NDArray<>(ndpw, 1, ndpw.length);
jep.set("r", r);
jep.set("d", d);
jep.set("gamma", gamma);
jep.set("smooth_win", smooth_win);
jep.set("s", s);
jep.set("n", n);
我最终得到了这个错误。
< class 'AttributeError' >: 'ImmutableDenseNDimArray' 对象没有属性 '_to_mpmath'
我搜索了原因,但一无所获。这个错误是什么意思?
编辑:
在库中,有一行代码用于Sympy
NDarray。我猜这个错误与那条线有关。
这是库中的行:
import sympy.functions.combinatorial.factorials as c
return -np.log(np.float(c.binomial(d, r)) * (p ** r) * (1 - p) ** (d - r))
解决方案
推荐阅读
- matlab - Matlab - 文本分析工具箱
- html - 如何对引导输入进行边界折叠?
- python - 将实例分配给关系时,sqlalchemy before_flush 事件处理程序看不到外键的变化
- swift - 如何使用 mapbox 用虚线绘制折线(MGLPolyline):swift
- corda - 在 Corda 中,liquibase.exception.SetupException: migration/account-application.changelog-master.xml 不存在
- ios - Xcode 9.4.1:架构 armv7、arm64、x86_64 的未定义符号
- scala - 从 AsyncEither 中提取值 - ScalaZ
- java - ScheduledExecutorService 在主线程中运行
- azure-devops - 从任务计划程序启动时,Powershell 脚本未完成
- xamarin - 我可以在资源而不是渲染器中定义不同的文本样式吗?