From 3955e7ac20114b987b82b2a0e448eb0ed3fa01e0 Mon Sep 17 00:00:00 2001 From: Dominik Strzako Date: Sun, 16 May 2021 15:19:28 +0200 Subject: [PATCH] even better version of 08 --- Zadanie_08_MLflow.py | 17 ++++++++++------- .../28466abc585446d78254527964ff8aaa/meta.yaml | 15 +++++++++++++++ .../metrics/Accuracy | 1 + .../params/batch_size | 1 + .../params/epochs | 1 + .../tags/mlflow.source.git.commit | 1 + .../tags/mlflow.source.name | 1 + .../tags/mlflow.source.type | 1 + .../tags/mlflow.user | 1 + 9 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 mlruns/0/28466abc585446d78254527964ff8aaa/meta.yaml create mode 100644 mlruns/0/28466abc585446d78254527964ff8aaa/metrics/Accuracy create mode 100644 mlruns/0/28466abc585446d78254527964ff8aaa/params/batch_size create mode 100644 mlruns/0/28466abc585446d78254527964ff8aaa/params/epochs create mode 100644 mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.git.commit create mode 100644 mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.name create mode 100644 mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.type create mode 100644 mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.user diff --git a/Zadanie_08_MLflow.py b/Zadanie_08_MLflow.py index 0c81c3d..ce68cab 100644 --- a/Zadanie_08_MLflow.py +++ b/Zadanie_08_MLflow.py @@ -14,13 +14,13 @@ import mlflow with mlflow.start_run(): - batch_param = 16 #int(sys.argv[1]) if len(sys.argv) > 1 else 16 - epoch_param = 15 #int(sys.argv[2]) if len(sys.argv) > 2 else 15 + batch_param = int(sys.argv[1]) if len(sys.argv) > 1 else 16 + epoch_param = int(sys.argv[2]) if len(sys.argv) > 2 else 15 mlflow.log_param("batch_size", batch_param) mlflow.log_param("epochs", epoch_param) - wine=pd.read_csv('train.csv') + wine=pd.read_csv('winequality-red.csv') y = wine['quality'] x = wine.drop('quality', axis=1) @@ -44,6 +44,8 @@ with mlflow.start_run(): scale = StandardScaler() scaled_x = scale.fit_transform(x) + x_train, x_test, y_train, y_test = train_test_split(scaled_x,yenc , test_size=0.2,train_size=0.8, random_state=21) + NeuralModel = Sequential([ Dense(128, activation='relu', input_shape=(14,)), Dense(32, activation='relu'), @@ -57,13 +59,14 @@ with mlflow.start_run(): NeuralModel.compile(optimizer=rms, loss='binary_crossentropy', metrics=['accuracy']) - NeuralModel.fit(scaled_x, yenc, batch_size= batch_param, epochs = epoch_param) #verbose = 1 + NeuralModel.fit(x_train, y_train, batch_size= batch_param, epochs = epoch_param) #verbose = 1 - #TO TYLKO NA POTRZEBY ZADANIA - y_pred = NeuralModel.predict(scaled_x) + y_pred = NeuralModel.predict(x_test) y_pred = np.around(y_pred, decimals=0) - results = accuracy_score(yenc,y_pred) + results = accuracy_score(y_test,y_pred) + + print(f"accuracy: {results}") mlflow.log_metric("Accuracy", results) \ No newline at end of file diff --git a/mlruns/0/28466abc585446d78254527964ff8aaa/meta.yaml b/mlruns/0/28466abc585446d78254527964ff8aaa/meta.yaml new file mode 100644 index 0000000..c70489c --- /dev/null +++ b/mlruns/0/28466abc585446d78254527964ff8aaa/meta.yaml @@ -0,0 +1,15 @@ +artifact_uri: file:///C:/Users/domstr2/Desktop/Git%20Repositories/ium_434788/mlruns/0/28466abc585446d78254527964ff8aaa/artifacts +end_time: 1621171137099 +entry_point_name: '' +experiment_id: '0' +lifecycle_stage: active +name: '' +run_id: 28466abc585446d78254527964ff8aaa +run_uuid: 28466abc585446d78254527964ff8aaa +source_name: '' +source_type: 4 +source_version: '' +start_time: 1621171134077 +status: 3 +tags: [] +user_id: domstr2 diff --git a/mlruns/0/28466abc585446d78254527964ff8aaa/metrics/Accuracy b/mlruns/0/28466abc585446d78254527964ff8aaa/metrics/Accuracy new file mode 100644 index 0000000..25f6a3a --- /dev/null +++ b/mlruns/0/28466abc585446d78254527964ff8aaa/metrics/Accuracy @@ -0,0 +1 @@ +1621171137096 1.0 0 diff --git a/mlruns/0/28466abc585446d78254527964ff8aaa/params/batch_size b/mlruns/0/28466abc585446d78254527964ff8aaa/params/batch_size new file mode 100644 index 0000000..19c7bdb --- /dev/null +++ b/mlruns/0/28466abc585446d78254527964ff8aaa/params/batch_size @@ -0,0 +1 @@ +16 \ No newline at end of file diff --git a/mlruns/0/28466abc585446d78254527964ff8aaa/params/epochs b/mlruns/0/28466abc585446d78254527964ff8aaa/params/epochs new file mode 100644 index 0000000..19c7bdb --- /dev/null +++ b/mlruns/0/28466abc585446d78254527964ff8aaa/params/epochs @@ -0,0 +1 @@ +16 \ No newline at end of file diff --git a/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.git.commit b/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.git.commit new file mode 100644 index 0000000..16dd30d --- /dev/null +++ b/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.git.commit @@ -0,0 +1 @@ +b2447b18df29bc57f4a9ee2ac3f6d53a6f4f8ab8 \ No newline at end of file diff --git a/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.name b/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.name new file mode 100644 index 0000000..1cea3eb --- /dev/null +++ b/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.name @@ -0,0 +1 @@ +Zadanie_08_MLflow.py \ No newline at end of file diff --git a/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.type b/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.type new file mode 100644 index 0000000..0c2c1fe --- /dev/null +++ b/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.source.type @@ -0,0 +1 @@ +LOCAL \ No newline at end of file diff --git a/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.user b/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.user new file mode 100644 index 0000000..313bd69 --- /dev/null +++ b/mlruns/0/28466abc585446d78254527964ff8aaa/tags/mlflow.user @@ -0,0 +1 @@ +domstr2 \ No newline at end of file