[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)
...
>>>
>>> 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)
...
>>>
相关文章推荐
- numpy power ValueError: Integers to negative integer powers are not allowed.
- You are not allowed to change cross-client customazing
- CodeIgniter文件上传时提示The filetype you are attempting to upload is not allowed
- 【Git之窗】(十二)you are not allowed to push code to protected branches on this project
- remote: GitLab: You are not allowed to push code to protected branches on this project.
- 【问题解决】YII2 Forbidden (#403) You are not allowed to access this page
- ng-repeat出现环路输出Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique
- Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to speci
- "Your computer could not be joined to the domain. You have exceeded the maximum number of computer accounts you are allowed to create in this domain. Contact your system administrator to have this limit reset or increased."
- Exception android.content.ReceiverCallNotAllowedException: IntentReceiver components are not allowed to bind to services(广播中的异常)
- [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq
- 解决Python中出现的ValueError: not enough values to unpack (expected 2, got 1)的问题
- [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq
- CodeIgniter “The filetype you are attempting to upload is not allowed.”解决
- Broadcastreceiver components are not allowed to bind to services in android
- git push 报错:Deploy keys are not allowed to push code
- 执行update操作的话,就会报“Connection is read-only. Queries leading to data modification are not allowed”的异常。
- Connection is read-only. Queries leading to data modification are not allowed
- Connection is read-only. Queries leading to data modification are not allowed
- 鉴定令牌不再有效,需要新的鉴定令牌 解决 [ User account has expired You (sumitgoel)are not allowed to ac ]