如何解决该错误:ImportError:无法导入名称'accuracy_score'?

时间:2018-11-30 06:05:35

标签: python import package train-test-split

我只是学习阅读python源代码。这是我正在研究的代码:

from __future__ import division, print_function
import numpy as np
from sklearn import datasets
from utils import train_test_split, accuracy_score, Plot
from random_forest.random_forest_model import RandomForest
def main():
    data = datasets.load_digits()
    X = data.data
    y = data.target
    ......

我跑步时

from utils import train_test_split, accuracy_score, Plot

我有以下错误:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
ImportError: cannot import name 'train_test_split'

即使安装软件包utils,此错误仍然会发生。 我该怎么办?

0 个答案:

没有答案