h2o - H2O 在 lambda 函数中抛出 Unexpected bytecode disassembly @ " + str(s) 错误
问题描述
有一段代码,例如...
predictions = randomforest_model.predict(frame_in_h2o)
print(predictions.describe())
# setting prediction values to maximize target metric
activation_thresh = drf_dx.find_threshold_by_max_metric('f2')
neg_class, pos_class = frame_in_h2o['dx_outcome'].categories()[0], frame_in_h2o['dx_outcome'].categories()[1]
print(neg_class, pos_class)
predictions['predict'] = predictions[pos_class].apply(lambda prob: pos_class if (prob >= activation_thresh) else neg_class)
...并且收到类似...的错误
Dumping disassembled code:
0 ['LOAD_FAST', ['prob']]
1 ['LOAD_GLOBAL', ['activation_thresh']]
2 ['COMPARE_OP', ['>=']]
3 ['POP_JUMP_IF_FALSE', [12]]
4 ['LOAD_GLOBAL', ['pos_class']]
5 --> ['RETURN_VALUE', []]
6 ['LOAD_GLOBAL', ['neg_class']]
7 ['RETURN_VALUE', []]
Unexpected bytecode disassembly @ 5
Traceback (most recent call last):
File "/home/myuser/projects/eda/eda.3.DX.py", line 385, in <module>
predictions['predict'] = predictions[pos_class].apply(lambda prob: pos_class if (prob >= activation_thresh) else neg_class)
File "/home/myuser/projects/venv/lib/python3.6/site-packages/h2o/frame.py", line 5012, in apply
res = lambda_to_expr(fun)
File "/home/myuser/projects/venv/lib/python3.6/site-packages/h2o/astfun.py", line 196, in lambda_to_expr
return _lambda_bytecode_to_ast(code, lambda_dis)
File "/home/myuser/projects/venv/lib/python3.6/site-packages/h2o/astfun.py", line 219, in _lambda_bytecode_to_ast
raise ValueError("Unexpected bytecode disassembly @ " + str(s))
ValueError: Unexpected bytecode disassembly @ 5
无法真正解释此错误的含义,但我可以确认neg_class
andpos_class
变量只是str
类型。我可以看到代码必须遇到这段代码(https://github.com/h2oai/h2o-3/blob/master/h2o-py/h2o/astfun.py#L213),但不能真的告诉问题是什么。
有人知道这里会发生什么吗?
解决方案
推荐阅读
- r - 更改以前的选择输入后如何使特定的选择输入空白?(不是基于同一个数据框)
- sql - 使用内部联接 (VBA) 对动态表执行动态查询时出错
- ggplot2 - ggplot2中各组百分比的条形图
- javascript - 使用@testing-library/react 对 react-router 的链接进行最简单的测试
- node.js - GSAP 无法在 node/express/ejs 项目中使用 NPM
- flutter - 是否可以在 Flutter 中不添加 Android 插件的情况下使用 PlatformView?
- javascript - 在 Puppeteer 中执行 JavaScript
- sql - 如何从sql中的逗号分隔字符串中删除_符号后的值?
- ios - 呈现 UIViewController 时 SafeAreas 行为不端
- python - 从文件名中提取日期并添加为列