To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit d4d60e7b authored by Feliks Kiszkurno's avatar Feliks Kiszkurno
Browse files

Fixed problem with overwriting feature importance when using GridSearch

parent 0663cafa
......@@ -21,11 +21,11 @@ from datetime import datetime
settings.init()
# Config
create_new_data = False # set to True if you need to reassign the classes
create_new_data = True # set to True if you need to reassign the classes
invert_existing_data = False # invert existing measurements
create_new_data_only = False # set to False in order to run ML classifications
create_new_data_only = True # set to False in order to run ML classifications
reassign_classes = False; class_type = 'norm'
param_path = os.path.abspath(os.path.join(os.getcwd()) + '/' + 'TestDefinitions/hor1__final_500_50.csv')
param_path = os.path.abspath(os.path.join(os.getcwd()) + '/' + 'TestDefinitions/hor1_final_5case.csv')
test_definitions.init(path=param_path)
# Load existing data instead of creating new one.
......
......@@ -64,13 +64,13 @@ def init():
settings['use_labels'] = False # True to use labels instead of classes
# Ignore data points with insufficient sensitivity
settings['min_sen_pred'] = False
settings['min_sen_pred'] = True
settings['min_sen_pred_val'] = 0.3
settings['min_sen_train'] = False
settings['min_sen_train'] = True
settings['min_sen_train_val'] = 0.3
# Include sensitivity
settings['sen'] = False # True - include sensitivity, False - ignore sensitivity
settings['sen'] = True # True - include sensitivity, False - ignore sensitivity
# Include depth
settings['depth'] = True # True - include depth, False - ignore depth
......
......@@ -111,7 +111,7 @@ def classification_predict(test_prediction, test_results, clf_name, num_feat, *,
importance = permutation_importance(clf_pipeline, x_question, y_pred)
slopestabilityML.plot_feature_importance(clf_pipeline, importance, x_question, test_name_pred,
slopestabilityML.plot_feature_importance(clf_name, importance, x_question, test_name_pred,
batch_name=batch_name)
log_file_name = settings.settings['log_file_name']
......
......@@ -201,7 +201,7 @@ def classification_train(test_training, test_results, clf, clf_name):
accuracy_labels_training.append(name)
importance = permutation_importance(clf_pipeline, x_train_temp, y_pred)
slopestabilityML.plot_feature_importance(clf_pipeline, importance, x_train_temp, name)
slopestabilityML.plot_feature_importance(clf_name, importance, x_train_temp, name)
log_file_name = settings.settings['log_file_name']
log_file = open(os.path.join(settings.settings['results_folder'], log_file_name), 'a')
......
......@@ -12,7 +12,7 @@ import os
import settings
def plot_feature_importance(clf, importance, x_train, test_name, *, batch_name=''):
def plot_feature_importance(clf_name, importance, x_train, test_name, *, batch_name=''):
# importance = permutation_importance(clf, x_train, y_question)
importance_mean_norm = importance.importances_mean / sum(importance.importances_mean)
......@@ -28,7 +28,7 @@ def plot_feature_importance(clf, importance, x_train, test_name, *, batch_name='
plt.subplots_adjust(left=.3)
for file_format in settings.settings['plot_formats']:
figure_name = clf.steps[1][0] + '_' + test_name + '.' + file_format
figure_name = clf_name + '_' + test_name + '.' + file_format
fig.figure.savefig(os.path.join(settings.settings['figures_folder'], batch_name, 'ML', 'feature_importance',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment