您好,欢迎来到步遥情感网。
搜索
您的当前位置:首页IndexError:boolean index did not match indexed array along dimension 0

IndexError:boolean index did not match indexed array along dimension 0

来源:步遥情感网

IndexError: boolean index did not match indexed array along dimension 0; dimension is 8 but corresponding boolean dimension is 7

在学习回归算法的时候,使用sklearn.linear_model下的RandomizedLogisticRegression(下列简称为RLR)来做预测某高考生是否能过二本。但是总是会遇到下面这个错误:

之后就想看下这个get_support()函数原型,找到官方文档,截个图:

可以看到returns部分,大概意思就是Indices是False,就返回一个类型是boolean的数组,如果indices是True,就返回一个整型数组,所以解决办法就是把参数改变。默认的是False,改成r1.get_support(indices=True)就好了。

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- obuygou.com 版权所有 赣ICP备2024042798号-5

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务