问题:文件无法打开
在使用 lightgbm 读取模型文件时不能打开
报错:
bash
Traceback (most recent call last):
File "detect_interpretability_.py", line 176, in <module>
lightgbm_test(White_data, os.path.basename(data_path), model_file = model_file, interpretability_path = interpretability_path, label = int(detection_label))
File "detect_interpretability_.py", line 54, in lightgbm_test
gbm = lgb.Booster(model_file = model_file)
File "/opt/work/nta/venv/lib/python3.6/site-packages/lightgbm/basic.py", line 2642, in __init__
ctypes.byref(self.handle)))
File "/opt/work/nta/venv/lib/python3.6/site-packages/lightgbm/basic.py", line 125, in _safe_call
raise LightGBMError(_LIB.LGBM_GetLastError().decode('utf-8'))
lightgbm.basic.LightGBMError: Could not open model.model
解决:换成绝对路径
笑哭了都
python
MODEL_FILE = '/home/root/litianchao/model.model'