我正尝试使用自己的数据集而不是MNIST数据集重现下面的2个教程。 https://docs.microsoft.com/ja-jp/azure/machine-learning/service/tutorial-auto-train-models https://docs.microsoft.com/ja-jp/azure/machine-learning/service/tutorial-deploy-models-with-aml
关于 '/notebooks/tutorials/03.auto-train-models.ipynb' 这里没有问题。我有'model.pkl'。
但是, '/notebooks/tutorials/02.deploy-models.ipynb' 在“预测测试数据”单元格下面有一个错误。 我想这是“挑剔”和“进口”的问题。
请告诉我解决方案。
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-11cf888b622f> in <module>
2 from sklearn.externals import joblib
3
----> 4 clf = joblib.load('./model.pkl')
5 # clf = joblib.load('./sklearn_mnist_model.pkl')
6 y_hat = clf.predict(X_test)
~/anaconda3_501/lib/python3.6/site-packages/sklearn/externals/joblib/numpy_pickle.py in load(filename, mmap_mode)
576 return load_compatibility(fobj)
577
--> 578 obj = _unpickle(fobj, filename, mmap_mode)
579
580 return obj
~/anaconda3_501/lib/python3.6/site-packages/sklearn/externals/joblib/numpy_pickle.py in _unpickle(fobj, filename, mmap_mode)
506 obj = None
507 try:
--> 508 obj = unpickler.load()
509 if unpickler.compat_mode:
510 warnings.warn("The file '%s' has been generated with a "
~/anaconda3_501/lib/python3.6/pickle.py in load(self)
1048 raise EOFError
1049 assert isinstance(key, bytes_types)
-> 1050 dispatch[key[0]](self)
1051 except _Stop as stopinst:
1052 return stopinst.value
~/anaconda3_501/lib/python3.6/pickle.py in load_global(self)
1336 module = self.readline()[:-1].decode("utf-8")
1337 name = self.readline()[:-1].decode("utf-8")
-> 1338 klass = self.find_class(module, name)
1339 self.append(klass)
1340 dispatch[GLOBAL[0]] = load_global
~/anaconda3_501/lib/python3.6/pickle.py in find_class(self, module, name)
1386 elif module in _compat_pickle.IMPORT_MAPPING:
1387 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1388 __import__(module, level=0)
1389 if self.proto >= 4:
1390 return _getattribute(sys.modules[module], name)[0]
ModuleNotFoundError: No module named 'automl'
答案 0 :(得分:0)
您必须包括azureml-train-automl软件包。而您必须这样做:
导入azureml.train.automl
答案 1 :(得分:0)
似乎您没有安装@Repository
python软件包。可以通过automl
导入它,但实际上应该使用pip进行安装。
请遵循this page上的指南,以了解如何为Azure ML服务设置python环境。
在大多数情况下,import azureml.train.automl
和notebook
是唯一需要的额外软件包,因此命令
automl
应该足够。
使用pip install --upgrade azureml-sdk[notebooks,automl]
查看所有已安装的软件包和版本号。如果软件包安装正确,您应该会看到pip list
。