我運行一個筆記本在Coursera平台上。Beplay体育安卓版本
我的配置文件,Classroom-Setup,看起來像這樣:
% python spark.conf.set (“com.databricks.training。模塊名稱”、“深度學習”)spark.conf.set (“com.databricks.training。expected-dbr”、“6.4”) spark.conf.set (“com.databricks.training.suppress。untilStreamIsReady”、“真實”)spark.conf.set (“com.databricks.training.suppress。stopAllStreams”、“真實”)spark.conf.set (“com.databricks.training.suppress。moduleName”、“真實”)spark.conf.set (“com.databricks.training.suppress。lessonName”、“真實”)# spark.conf.set (“com.databricks.training.suppress。用戶名”,“真正的”)spark.conf.set (“com.databricks.training.suppress。userhome”、“真實”)# spark.conf.set (“com.databricks.training.suppress。workingDir”、“真實”)spark.conf.set (“com.databricks.training.suppress。數據庫名”、“真實”)進口警告warnings.filterwarnings(“忽略”)#進口tensorflow def display_run_uri (experiment_id run_id): host_name = dbutils.notebook.entry_point.getDbutils () .notebook () .getContext () .tags () . get (" browserHostName ") . get()的uri = " https:// {} / # mlflow /實驗/{}/運行/ {}”.format (host_name、experiment_id run_id) displayHTML (" " < b > Run uri: < / b > < a href = " {} " > {} < / >”“.format (uri uri)) def waitForMLflow():試題:進口mlflow;如果int (mlflow.__version__.split(“。”)[1]) > = 2:印刷(““模塊”mlflow”連接,準備好了。”" ");其他:打印(”““你需要MLflow版本1.2.0 +安裝。”" ")除了ModuleNotFoundError:打印(““模塊”MLflow”還沒有連接到集群中,等待…”" ");而真正的嚐試:進口mlflow;打印(“”“模塊”mlflow”連接,準備好了。”" "); break; except ModuleNotFoundError: import time; time.sleep(1); print(".", end=""); from sklearn.metrics import confusion_matrix,f1_score,accuracy_score,fbeta_score,precision_score,recall_score import matplotlib.pyplot as plt import numpy as np from sklearn.utils.multiclass import unique_labels def plot_confusion_matrix(y_true, y_pred, classes, title=None, cmap=plt.cm.Blues): # Compute confusion matrix cm = confusion_matrix(y_true, y_pred) fig, ax = plt.subplots() im = ax.imshow(cm, interpolation='nearest', cmap=cmap) ax.figure.colorbar(im, ax=ax) ax.set(xticks=np.arange(cm.shape[1]), yticks=np.arange(cm.shape[0]), xticklabels=classes, yticklabels=classes, title=title, ylabel='True label', xlabel='Predicted label') plt.setp(ax.get_xticklabels(), rotation=45, ha="right", rotation_mode="anchor") fmt = 'd' thresh = cm.max() / 2. for i in range(cm.shape[0]): for j in range(cm.shape[1]): ax.text(j, i, format(cm[i, j], fmt), ha="center", va="center", color="white" if cm[i, j] > thresh else "black") fig.tight_layout() return fig np.set_printoptions(precision=2) displayHTML("Preparing the learning environment...")
運行這個命令,我沒有問題
%運行”。包括/ Classroom-Setup”說,所有已定義的函數。
當我運行這個,
% python
進口mlflow
進口mlflow.spark
在下一個細胞,我得到一個ModelNotFoundError:
ModuleNotFoundError回溯(去年)最近調用<命令- 1419217929106651 > <模塊> - - - - - > 1導入mlflow 2 mlflow進口。火花/磚/ python_shell / dbruntime / PythonPackageImportsInstrumentation / __init__。py import_patch(名稱、全局當地人,fromlist,級別)156 #進口所需的模塊。如果你看到這個調試失敗的導入,157 #看看前麵的堆棧幀相關的錯誤信息。- - > 158 original_result = python_builtin_import(名稱、全局當地人,fromlist,級別)159 160 is_root_import = thread_local。_nest_level = = 1 ModuleNotFoundError:沒有模塊命名“mlflow”
的原因是什麼以及如何我可以修複它嗎?不幸的是,Coursera不幫助這個特殊的課程。
謝謝你,我的新磚。