导入 scipy.special.expit 时出错 [英] Error importing scipy.special.expit
问题描述
我想导入 scipy.special.expit
中可用的 sigmoid 函数.
I want to import the sigmoid function available at scipy.special.expit
.
如果我使用 import scipy.special.expit as sigmoid
(或不使用as sigmoid"),我会收到No module called expit"错误.
If I use import scipy.special.expit as sigmoid
(or without the "as sigmoid") I get a "No module called expit" error.
如果我使用 from scipy import special
,那么使用 special.expit(N)
有效.
If I use from scipy import special
, then using special.expit(N)
works.
如果我使用 from scipy import special.expit as sigmoid
,special.expit
(点)处的语法无效.
If I use from scipy import special.expit as sigmoid
, invalid syntax at special.expit
(the dot).
如果我使用 from scipy.special import expit
,special
不是定义错误.
If I use from scipy.special import expit
, special
is not defined error.
那么……我到底怎么才能导入分配sigmoid"别名的expit
函数?
So... how the hell can I import the expit
function assigning the "sigmoid" alias?
推荐答案
正如我在评论中指出的,
As I noted in a comment,
from scipy.special import expit
应该可以.要导入名称为 sigmoid
的 expit
,请使用
should work. To import expit
with the name sigmoid
, use
from scipy.special import expit as sigmoid
这篇关于导入 scipy.special.expit 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!