changed model

This commit is contained in:
Dawid 2021-05-23 13:39:05 +02:00
parent ec6c4892c8
commit 43b4cd4864
14 changed files with 60 additions and 7 deletions

View File

@ -0,0 +1,20 @@
flavors:
keras:
data: data
keras_module: tensorflow.keras
keras_version: 2.5.0
save_format: tf
python_function:
data: data
env: conda.yaml
loader_module: mlflow.keras
python_version: 3.9.4
saved_input_example_info:
artifact_path: input_example.json
format: tf-serving
type: ndarray
signature:
inputs: '[{"type": "tensor", "tensor-spec": {"dtype": "float64", "shape": [-1, 8]}}]'
outputs: '[{"type": "tensor", "tensor-spec": {"dtype": "float32", "shape": [-1,
1]}}]'
utc_time_created: '2021-05-23 10:44:42.850073'

View File

@ -0,0 +1,10 @@
channels:
- defaults
- conda-forge
dependencies:
- python=3.9.4
- pip
- pip:
- mlflow
- tensorflow==2.5.0-rc1
name: mlflow-env

View File

@ -0,0 +1 @@
tensorflow.keras

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
tf

View File

@ -0,0 +1 @@
{"inputs": [503810.0, 385506.0, 118304.0, 31121.0, 307.01, 234.94, 72.08000000000001, 158695.0]}

View File

@ -1,9 +1,9 @@
import sys
import pandas as pd
import mlflow as mlf
from tensorflow import keras
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error as rmse
import mlflow as mlf
def create_model(test_size, epochs, batch_size):
@ -28,28 +28,28 @@ def create_model(test_size, epochs, batch_size):
model.fit(X_train, y_train, epochs = epochs, validation_split = 0.3, batch_size = batch_size)
signature = mlf.models.signature.infer_signature(X_train.values, model.predict(X_train.values))
input_example = X_test.values[10]
prediction = model.predict(X_test)
rmse_result = rmse(y_test, prediction, squared = False)
print(prediction)
model.save('vaccines_model')
return model, rmse_result
return model, rmse_result, signature, input_example
if __name__ == "__main__":
test_size = float(sys.argv[1]) if len(sys.argv) > 1 else 0.2
epochs = int(sys.argv[2]) if len(sys.argv) > 1 else 100
batch_size = int(sys.argv[3]) if len(sys.argv) > 1 else 32
with mlf.start_run():
mlf.log_param("Test size", test_size)
mlf.log_param("Epochs", epochs)
mlf.log_param("Batch size", batch_size)
model, rmse_result = create_model(
model, rmse_result, signature, input_example = create_model(
test_size=test_size,
epochs=epochs,
batch_size=batch_size,
)
mlf.log_metric("RMSE", rmse_result)
mlf.keras.log_model(model, "country_vaccination")
# mlf.keras.log_model(model, "country_vaccination")
mlf.keras.save_model(model, "country_vaccination", input_example=input_example, signature=signature)

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.