changed model
This commit is contained in:
parent
ec6c4892c8
commit
43b4cd4864
20
country_vaccination/MLmodel
Normal file
20
country_vaccination/MLmodel
Normal 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'
|
10
country_vaccination/conda.yaml
Normal file
10
country_vaccination/conda.yaml
Normal 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
|
1
country_vaccination/data/keras_module.txt
Normal file
1
country_vaccination/data/keras_module.txt
Normal file
@ -0,0 +1 @@
|
||||
tensorflow.keras
|
10
country_vaccination/data/model/keras_metadata.pb
Normal file
10
country_vaccination/data/model/keras_metadata.pb
Normal file
File diff suppressed because one or more lines are too long
BIN
country_vaccination/data/model/saved_model.pb
Normal file
BIN
country_vaccination/data/model/saved_model.pb
Normal file
Binary file not shown.
Binary file not shown.
BIN
country_vaccination/data/model/variables/variables.index
Normal file
BIN
country_vaccination/data/model/variables/variables.index
Normal file
Binary file not shown.
1
country_vaccination/data/save_format.txt
Normal file
1
country_vaccination/data/save_format.txt
Normal file
@ -0,0 +1 @@
|
||||
tf
|
1
country_vaccination/input_example.json
Normal file
1
country_vaccination/input_example.json
Normal file
@ -0,0 +1 @@
|
||||
{"inputs": [503810.0, 385506.0, 118304.0, 31121.0, 307.01, 234.94, 72.08000000000001, 158695.0]}
|
@ -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)
|
10
vaccines_model/keras_metadata.pb
Normal file
10
vaccines_model/keras_metadata.pb
Normal file
File diff suppressed because one or more lines are too long
BIN
vaccines_model/saved_model.pb
Normal file
BIN
vaccines_model/saved_model.pb
Normal file
Binary file not shown.
BIN
vaccines_model/variables/variables.data-00000-of-00001
Normal file
BIN
vaccines_model/variables/variables.data-00000-of-00001
Normal file
Binary file not shown.
BIN
vaccines_model/variables/variables.index
Normal file
BIN
vaccines_model/variables/variables.index
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user