AttributeError: 无法在 ‘sklearn.metrics._dist_metrics’ 模块中获取 ‘EuclideanDistance’ 属性

huangapple go评论89阅读模式
英文:

AttributeError: Can't get attribute 'EuclideanDistance' on <module 'sklearn.metrics._dist_metrics' from 'C:\\Python311\\Lib\\site-packages\\sklearn\\

问题

抱歉,我仍然是一个初学者。我想找出这个模型是否正常工作,但出现了错误。

knn_model = pickle.load(open('knn_pickle.sav', 'rb'))

value_Output = ''

data = (2, 12, 96, 53, 1, 1)

result_Prediction = knn_model.predict([data])

if(result_Prediction[0] == 1):
    value_Output = 'It works'
else:
    value_Output = "It doesn't work"

然后我遇到了这个错误:

AttributeError: 在'C:\\ Python311 \\ Lib \\ site-packages \\ sklearn \\ metrics \\ _dist_metrics.cp311-win_amd64.pyd'中,无法获取属性'EuclideanDistance'的值

有人可以帮助我吗?

英文:

Sorry I'm still a beginner. I want to find out if this model works properly or not, but there is an error.

knn_model = pickle.load(open(&#39;knn_pickle.sav&#39;, &#39;rb&#39;))
   
value_Output = &#39;&#39;

data = (2, 12, 96, 53, 1, 1)

result_Prediction = knn_model.predict([data])
    
if(result_Prediction[0] == 1):
    value_Output = &#39;It works&#39;
else:
    value_Output = &quot;It doesn&#39;t work&quot;

And then I hit this error:

AttributeError: Can&#39;t get attribute &#39;EuclideanDistance&#39; on &lt;module &#39;sklearn.metrics._dist_metrics&#39; 
  from &#39;C:\\Python311\\Lib\\site-packages\\sklearn\\metrics\\_dist_metrics.cp311-win_amd64.pyd&#39;&gt;

Anyone can help me please?

答案1

得分: 1

Scikit-Learn 1.2.2的sklearn.metrics._dist_metrics模块有EuclideanDistance()EuclideanDistance32()。然而,版本1.3.0中有EuclideanDistance32()EuclideanDistance64(),而不再有EuclideanDistance()。我猜他们在1.3.0中用EuclideanDistance64()替代了EuclideanDistance()

英文:

Scikit-Learn 1.2.2's sklearn.metrics._dist_metrics module has EuclideanDistance() and EuclideanDistance32(). However, version 1.3.0 has EuclideanDistance32() and EuclideanDistance64(), instead of EuclideanDistance(). I guess they replaced EuclideanDistance() with EuclideanDistance64() in 1.3.0.

huangapple
  • 本文由 发表于 2023年7月7日 01:38:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76631305.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定