您的位置:首页 > 编程语言 > Python开发

[Python][Numpy] ValueError: Integers to negative integer powers are not allowed.

2017-12-18 19:51 1676 查看
The code snippet is as follows:

>>> for c in np.arange(-5, 5):
...     lr = LogisticRegression(C=np.int(10**c), random_state=0) 
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ValueError: Integers to negative integer powers are not allowed.
>>> 

To fix that error, the for block will be:

>>> for c in np.arange(-5, 5, dtype=float):
...     lr = LogisticRegression(C=10**c, random_state=0)
... 
>>> 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐