From 6eacb7ca0f0e7038a827ec9907d0d99ba336f88e Mon Sep 17 00:00:00 2001 From: ilydzi Date: Sat, 2 Dec 2023 19:25:54 +0100 Subject: [PATCH] Added simple imputation to model inference --- machine_learning/model_inference.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/machine_learning/model_inference.py b/machine_learning/model_inference.py index 46b4e9a..8d18975 100644 --- a/machine_learning/model_inference.py +++ b/machine_learning/model_inference.py @@ -1,6 +1,7 @@ import os import joblib import pandas as pd +from sklearn.impute import SimpleImputer TEST_DATA_DIR = "datasets_test" @@ -15,6 +16,9 @@ for file in os.listdir(TEST_DATA_DIR): data_test = pd.concat(test_df_list, ignore_index=True).sample(frac=1, random_state=42) X_test = data_test.iloc[:, 1:-1].values +imputer = SimpleImputer(strategy='mean') +X_imputed = imputer.fit_transform(X_test) + model_filename = 'trained_model.pkl' model = joblib.load(model_filename)