python-3.x - Python H2O 脚本:结束/关闭时的 TypeErrors
问题描述
文件h2otest.py包含https://docs.h2o.ai/h2o/latest-stable/h2o-docs/data-science/glm.html上的代码的缩短版本:
import h2o
h2o.init()
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
prostate = h2o.import_file("https://h2o-public-test-data.s3.amazonaws.com/smalldata/prostate/prostate.csv")
prostate['CAPSULE'] = prostate['CAPSULE'].asfactor()
prostate['RACE'] = prostate['RACE'].asfactor()
prostate['DCAPS'] = prostate['DCAPS'].asfactor()
prostate['DPROS'] = prostate['DPROS'].asfactor()
predictors = ["AGE", "RACE", "VOL", "GLEASON"]
response_col = "CAPSULE"
glm_model = H2OGeneralizedLinearEstimator(family="binomial", lambda_= 0, compute_p_values=True)
glm_model.train(predictors, response_col, training_frame= prostate)
print('Finished')
我在 Conda 环境pycharm中的命令行上运行代码,其中 h2o 3.30.1.3 是从 PyPi 安装的。我正在使用 Python 3.8。我在我的 Mac 和 Linux 服务器上都遇到了同样的错误。启动时没有现有的 H2O 服务器:
(pycharm) $> python h2otest.py
该代码完成了它的工作,但在最后给出了错误消息:
...
Parse progress: |█████████████████████████████████████████████████████████████████████████████| 100%
glm Model Build progress: |███████████████████████████████████████████████████████████████████| 100%
Finished
Closing connection _sid_a7a8 at exit
H2O session _sid_a7a8 closed.
Exception ignored in: <function ExprNode.__del__ at 0x7f9ee65f83a0>
Traceback (most recent call last):
File "/Users/geiringesandnes/miniconda3/envs/pycharm/lib/python3.8/site-packages/h2o/expr.py", line 204, in __del__
File "/Users/geiringesandnes/miniconda3/envs/pycharm/lib/python3.8/site-packages/h2o/expr.py", line 258, in rapids
TypeError: 'NoneType' object is not callable
Exception ignored in: <function ExprNode.__del__ at 0x7f9ee65f83a0>
Traceback (most recent call last):
File "/Users/geiringesandnes/miniconda3/envs/pycharm/lib/python3.8/site-packages/h2o/expr.py", line 204, in __del__
File "/Users/geiringesandnes/miniconda3/envs/pycharm/lib/python3.8/site-packages/h2o/expr.py", line 258, in rapids
TypeError: 'NoneType' object is not callable
Exception ignored in: <function ExprNode.__del__ at 0x7f9ee65f83a0>
Traceback (most recent call last):
File "/Users/geiringesandnes/miniconda3/envs/pycharm/lib/python3.8/site-packages/h2o/expr.py", line 204, in __del__
File "/Users/geiringesandnes/miniconda3/envs/pycharm/lib/python3.8/site-packages/h2o/expr.py", line 258, in rapids
TypeError: 'NoneType' object is not callable
Exception ignored in: <function ExprNode.__del__ at 0x7f9ee65f83a0>
Traceback (most recent call last):
File "/Users/geiringesandnes/miniconda3/envs/pycharm/lib/python3.8/site-packages/h2o/expr.py", line 204, in __del__
File "/Users/geiringesandnes/miniconda3/envs/pycharm/lib/python3.8/site-packages/h2o/expr.py", line 258, in rapids
TypeError: 'NoneType' object is not callable
我怎样才能摆脱那些错误信息?
解决方案
推荐阅读
- excel - How to fix this "ambiguous name detected Worksheet_Change"?
- openedge - FILL-IN基本组件中如何避免千位分隔符
- sql - 在 SQL Server Management Studio (SSMS) 中禁用空白文本的副本
- javascript - ag-grid:key.forEach 在调整列大小时不是函数控制台错误
- nvidia-jetson - Jetson nano 模块与生产开发人员
- javascript - 在 JSX 中的条件语句中的 SetState 反应原生?
- git - TFS 2012 中的默认合并工具是三向还是双向?
- mysql - 在我的 mysql 表中的两列中合并具有相同值的重复行并在第三列中添加值
- java - AccessibilityNodeInfo getText() 始终为 null
- ffmpeg - ffmpeg 可以在单个命令中提取视频文件的多个部分吗?