Added simple imputation to model inference

This commit is contained in:
ilydzi 2023-12-02 19:25:54 +01:00
parent f779dfc4e0
commit 6eacb7ca0f

View File

@ -1,6 +1,7 @@
import os import os
import joblib import joblib
import pandas as pd import pandas as pd
from sklearn.impute import SimpleImputer
TEST_DATA_DIR = "datasets_test" 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) data_test = pd.concat(test_df_list, ignore_index=True).sample(frac=1, random_state=42)
X_test = data_test.iloc[:, 1:-1].values 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_filename = 'trained_model.pkl'
model = joblib.load(model_filename) model = joblib.load(model_filename)