0

有一段代码,例如...

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_classandpos_class变量只是str类型。我可以看到代码必须遇到这段代码(https://github.com/h2oai/h2o-3/blob/master/h2o-py/h2o/astfun.py#L213),但不能真的告诉问题是什么。

有人知道这里会发生什么吗?

4

0 回答 0