diff --git a/models/hyperparam_tuning.py b/models/hyperparam_tuning.py index e3e623850411efc6ac0ca1950b3caa0e932908ea..311a7187f8126fb71c868ff104dc102c23e2c157 100644 --- a/models/hyperparam_tuning.py +++ b/models/hyperparam_tuning.py @@ -152,9 +152,7 @@ if __name__ == "__main__": # Store each df as a sheet in an excel file sheets_dict = {} for i, group in enumerate(['pre', 'post']): - print(group, end = ' ') for j, method in enumerate(['', '', 'over_', 'under_']): - print(method, end = ' ') # Get dataset based on group and method X = data_dic['X_train_' + method + group] y = data_dic['y_train_' + method + group] @@ -163,7 +161,7 @@ if __name__ == "__main__": # Save results: params and best score for each of the mdodels of this method and group hyperparam_df = pd.DataFrame(index=list(models.keys()), columns=['Parameters','Score']) for model_name, model in models.items(): - print(model_name + "\n\n") + print(f"{group}-{method}-{model_name} \n\n") # Find optimal hyperparams for curr model params = hyperparameters[model_name] search = RandomizedSearchCV(model, param_distributions=params, cv=cv, n_jobs=1, scoring='precision') diff --git a/models/shap.py b/models/shap.py new file mode 100644 index 0000000000000000000000000000000000000000..afca58d504b45cfe4f6b3f5a90bd8f062d1aed00 --- /dev/null +++ b/models/shap.py @@ -0,0 +1,10 @@ +# Libraries +# -------------------------------------------------------------------------------------------------------- +import shap +import numpy as np +# -------------------------------------------------------------------------------------------------------- + +# Load test data +X_test_pre = np.load('../gen_train_data/data/output/pre/X_test_pre.npy', allow_pickle=True) + +print(list(X_test_pre.columns.values)) \ No newline at end of file