在调试模式下,sklearn' s roc_auc_score错误,但正常运行时运行良好?
我正在使用roc_auc_score
来评估两个数组之间的AUC,即真相和估计。当我正常在Pycharms上执行该代码时,我的代码运行正常;但是,当我使用调试模式时,以下奇怪的错误弹出。我尝试在roc_auc_score
行之前暂停代码,并尝试使用仅使用2个小数组的调试控制台运行它。同样的问题。奇怪的是,使用普通Python控制台一切都很好。有什么想法吗?
Traceback (most recent call last):
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\numpy\core\getlimits.py", line 649, in __init__
self.dtype = numeric.dtype(int_type)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2022.1.2\plugins\python\helpers\pydev\pydevd.py", line 1491, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2022.1.2\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/User/PycharmProjects/project/main-resnet.py", line 707, in <module>
results = train_net(net=net,
File "C:/Users/User/PycharmProjects/project/main-resnet.py", line 495, in train_net
train_auc = roc_auc_score(training_true, training_estimated)
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\sklearn\metrics\_ranking.py", line 566, in roc_auc_score
y_true = label_binarize(y_true, classes=labels)[:, 0]
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\sklearn\preprocessing\_label.py", line 546, in label_binarize
Y = sp.csr_matrix((data, indices, indptr), shape=(n_samples, n_classes))
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\scipy\sparse\compressed.py", line 66, in __init__
idx_dtype = get_index_dtype((indices, indptr),
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\scipy\sparse\sputils.py", line 153, in get_index_dtype
int32min = np.iinfo(np.int32).min
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\numpy\core\getlimits.py", line 651, in __init__
self.dtype = numeric.dtype(type(int_type))
TypeError: 'NoneType' object is not callable
python-BaseException
I'm using roc_auc_score
to evaluate AUC between two arrays, the truth and the estimation. My code runs fine when I'm executing it normally on PyCharms; however, when I use the debug mode, the below strange errors pop up. I tried pausing the code prior to the roc_auc_score
line and attempted to just run it using the debug console with just 2 small arrays. Same issue. Strangely, everything is fine using the normal Python console. Any ideas?
Traceback (most recent call last):
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\numpy\core\getlimits.py", line 649, in __init__
self.dtype = numeric.dtype(int_type)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2022.1.2\plugins\python\helpers\pydev\pydevd.py", line 1491, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2022.1.2\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/User/PycharmProjects/project/main-resnet.py", line 707, in <module>
results = train_net(net=net,
File "C:/Users/User/PycharmProjects/project/main-resnet.py", line 495, in train_net
train_auc = roc_auc_score(training_true, training_estimated)
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\sklearn\metrics\_ranking.py", line 566, in roc_auc_score
y_true = label_binarize(y_true, classes=labels)[:, 0]
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\sklearn\preprocessing\_label.py", line 546, in label_binarize
Y = sp.csr_matrix((data, indices, indptr), shape=(n_samples, n_classes))
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\scipy\sparse\compressed.py", line 66, in __init__
idx_dtype = get_index_dtype((indices, indptr),
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\scipy\sparse\sputils.py", line 153, in get_index_dtype
int32min = np.iinfo(np.int32).min
File "C:\Users\User\anaconda3\envs\project\lib\site-packages\numpy\core\getlimits.py", line 651, in __init__
self.dtype = numeric.dtype(type(int_type))
TypeError: 'NoneType' object is not callable
python-BaseException
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧...猜猜我只是在谷歌搜索错误的事情:P
这似乎是Pycharms和Python版本之间的问题( https://youtrack.jetbrains.com/issue/py-52137 )。
从Python 3.10.1转换为3.9应该可以工作。
Well... guess I was simply googling the wrong thing :P
It seems to be an issue between PyCharms and the python version (https://youtrack.jetbrains.com/issue/PY-52137).
Switching from Python 3.10.1 to 3.9 should work.