您好,我正在尝试使用pypi kds
包。
我已经安装了:pip install kds
我没有任何安装问题。但当我运行以下示例脚本时:
# REPRODUCABLE EXAMPLE
# Load Dataset and train-test split
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn import tree
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33,random_state=3)
clf = tree.DecisionTreeClassifier(max_depth=1,random_state=3)
clf = clf.fit(X_train, y_train)
y_prob = clf.predict_proba(X_test)
# The magic happens here
import kds
kds.metrics.report(y_test, y_prob)
它给出了一个错误:
AttributeError Traceback (most recent call last)
<ipython-input-4-fa00bcb248e7> in <module>
13 # The magic happens here
14 import kds
---> 15 kds.metrics.report(y_test, y_prob)
AttributeError: module 'kds' has no attribute 'metrics'
问题已在最新版本中解决。请使用
pip install kds
更新包也不要忘记最后一行中的y_prob[:,1]。(scikit学习的输出有2列,因此选择1列)
相关问题 更多 >
编程相关推荐