lightgbm版本问题

[LightGBM] [Fatal] The number of features in data (110) is not the same as it was in training data (114).
You can set ``predict_disable_shape_check=true`` to discard this error, but please be aware what you are doing.
Traceback (most recent call last):
  File "test.py", line 161, in <module>
    predictions1 += clf.predict(X_test)
  File "/home/amax/anaconda3/envs/tensorflow_1/lib/python3.6/site-packages/lightgbm/basic.py", line 3540, in predict
    data_has_header, is_reshape)
  File "/home/amax/anaconda3/envs/tensorflow_1/lib/python3.6/site-packages/lightgbm/basic.py", line 848, in predict
    preds, nrow = self.__pred_for_np2d(data, start_iteration, num_iteration, predict_type)
  File "/home/amax/anaconda3/envs/tensorflow_1/lib/python3.6/site-packages/lightgbm/basic.py", line 938, in __pred_for_np2d
    return inner_predict(mat, start_iteration, num_iteration, predict_type)
  File "/home/amax/anaconda3/envs/tensorflow_1/lib/python3.6/site-packages/lightgbm/basic.py", line 920, in inner_predict
    preds.ctypes.data_as(ctypes.POINTER(ctypes.c_double))))
  File "/home/amax/anaconda3/envs/tensorflow_1/lib/python3.6/site-packages/lightgbm/basic.py", line 125, in _safe_call
    raise LightGBMError(_LIB.LGBM_GetLastError().decode('utf-8'))
lightgbm.basic.LightGBMError: The number of features in data (110) is not the same as it was in training data (114).
You can set ``predict_disable_shape_check=true`` to discard this error, but please be aware what you are doing.

当使用lightgbm 3.2.1版本时,就会报这个错误,发现我之前用2.2.3的时候就不会,真神奇。

指定版本安装的问题找了很久,发现自己就是个傻子,

pip install lightgbm==2.2.3这句话就解决了。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
LightGBM是一个高效的梯度提升框架,它可以用于解决分类和回归问题。在使用LightGBM的MATLAB接口之前,需要进行一些设置和准备工作。 首先,需要通过在Releasefolder中编译出lib_lightgbm.lib静态库,并将其加载到MATLAB中使用。你可以使用“ungil-LightGBM-MATLAB”中的“lgbmLoad.m”文件来实现这一步骤。 其次,如果你之前安装过低版本的Visual Studio,然后又安装了较新版本的Visual Studio,在Git Bash中使用命令“cmake -A x64 ..”时可能会遇到找不到编译器或MSbuild.exe的问题。解决办法是删除旧版本LightGBM,然后再次使用“git clone --recursive https://github.com/microsoft/LightGBM”命令来下载一个新的版本。 还需要注意的是,在使用LightGBM的MATLAB接口时,要确保lib_lightgbm.dll文件位于原目录下(即:C:\Users\T\LightGBM\Release),而不是C:\Users\T\LightGBM\include\LightGBM目录下的c_api.h头文件。 总之,通过编译生成lib_lightgbm.lib静态库,并按照上述步骤正确设置和使用LightGBM的MATLAB接口,你就可以在MATLAB中使用LightGBM了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [如何生成LightGBM的dll文件](https://blog.csdn.net/zhshow/article/details/90729580)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值