prediction fix
All checks were successful
s444507-predict-s444356/pipeline/head This commit looks good
s444507-evaluation/pipeline/head This commit looks good
444507-training/pipeline/head This commit looks good

This commit is contained in:
Adam Wojdyla 2022-05-16 07:34:02 +02:00
parent 291a28cc18
commit 4e1160e7f8

View File

@ -1,15 +1,14 @@
import mlflow
import mlflow.sklearn
import pandas as pd
import numpy as np
import json import json
import mlflow
import numpy as np
logged_model = 'mlruns/1/4b83e774512444188fb587288818c298/artifacts/model' logged_model = 'mlruns/1/4b83e774512444188fb587288818c298/artifacts/model'
model = mlflow.pyfunc.load_model(logged_model) loaded_model = mlflow.pyfunc.load_model(logged_model)
with open('my_model/input_example.json') as f:
with open('input_example.json') as f:
data = json.load(f) data = json.load(f)
input_example = np.array([data['inputs'][0]]).reshape(-1,4) input_example = np.array([data['inputs'][0]], dtype=np.float64).reshape(-1, 2)
print(f'Prediction: {model.predict(input_example)}')
print(f'Prediction: {loaded_model.predict(input_example)}')