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 f55e1ba1 authored by Feliks Kiszkurno's avatar Feliks Kiszkurno
Browse files

some bug fixes

parent f74761ea
......@@ -46,7 +46,7 @@ def init():
settings['grd'] = True
# Sample weight
settings['weight'] = False
settings['weight'] = True
# Parameters for resampling
settings['resample'] = False
......@@ -64,16 +64,16 @@ def init():
settings['use_labels'] = False # True to use labels instead of classes
# Ignore data points with insufficient sensitivity
settings['min_sen_pred'] = True
settings['min_sen_pred'] = False
settings['min_sen_pred_val'] = 0.3
settings['min_sen_train'] = True
settings['min_sen_train'] = False
settings['min_sen_train_val'] = 0.3
# Include sensitivity
settings['sen'] = True # True - include sensitivity, False - ignore sensitivity
# Include depth
settings['depth'] = True # True - include depth, False - ignore depth
settings['depth'] = False # True - include depth, False - ignore depth
# Borehole simulation
settings['sim_bh'] = True
......@@ -81,10 +81,10 @@ def init():
2: {'x_start': 0, 'x_end': 2, 'y_start': -18, 'y_end': 0}}
# Balance classes
settings['balance'] = False
settings['balance'] = True
# Classifiers
settings['optimize_ml'] = True # True - performs hyperparameter search
settings['optimize_ml'] = False # True - performs hyperparameter search
settings['optimize_ml_type'] = 'exhaustive' # Type of grid search exhaustive or halved
# Plots
......
......@@ -27,23 +27,22 @@ def balance_classes(test_results, *, test_name='name'):
classes_count[class_id] = len(test_results[test_results['CLASSN'] == classes_list[class_id]].index)
classes_count_max = np.max(classes_count)
classes_max = classes_list[np.where(classes_count == classes_count_max)]
classes_max = classes_list[np.where(classes_count == classes_count_max)][0]
test_results_resamp = pd.DataFrame(columns=test_results.columns.values.tolist())
for class_id in range(len(classes_list)):
if class_id != classes_max:
test_results_temp = test_results[test_results['CLASSN'] == class_id].copy()
test_results_temp = test_results_temp.drop(columns=['CLASSN'])
test_results_temp = test_results[test_results['CLASSN'] == class_id].copy()
test_results_temp = test_results_temp.drop(columns=['CLASSN'])
test_results_temp_resamp = resample(test_results_temp,
replace=True,
n_samples=int(classes_count_max))
test_results_temp_resamp = resample(test_results_temp,
replace=True,
n_samples=int(classes_count_max))
test_results_temp_resamp['CLASSN'] = np.ones(len(test_results_temp_resamp.index))*classes_list[class_id]
test_results_temp_resamp['CLASSN'] = np.ones(len(test_results_temp_resamp.index))*classes_list[class_id]
test_results_resamp = pd.concat([test_results_resamp, test_results_temp_resamp])
test_results_resamp = pd.concat([test_results_resamp, test_results_temp_resamp])
test_results_resamp['NAME'] = [test_name]*len(test_results_resamp.index)
......
......@@ -129,7 +129,7 @@ def classification_train(test_training, test_results, clf, clf_name):
for borehole_id in settings.settings['bh_pos'].keys():
bh_pos = settings.settings['bh_pos'][borehole_id]
df_temp = test_results_combined_orig.loc[(test_results_combined_orig['X'] > bh_pos['x_start']) &
(test_results_combined_orig['X'] < bh_pos['x_end']) &
(test_results_combined_orig['X'] < bh_pos['x_end'])&
(test_results_combined_orig['Y'] > bh_pos['y_start']) &
(test_results_combined_orig['Y'] < bh_pos['y_end'])]
test_results_combined = test_results_combined.append(df_temp)
......
......@@ -38,31 +38,31 @@ def run_all_tests(test_results):
ml_results_class['svm'] = svm_result_class
gc.collect()
#
# print('Running GBC...')
# gbc_results, gbc_result_class = slopestabilityML.GBC.gbc_run(test_results, random_seed)
# ml_results['gbc'] = gbc_results
#
# ml_results_class['gbc'] = gbc_result_class
#
# gc.collect()
#
# print('Running SGD...')
# sgd_results, sgd_result_class = slopestabilityML.SGD.sgd_run(test_results, random_seed)
# ml_results['sgd'] = sgd_results
#
# ml_results_class['sgd'] = sgd_result_class
#
# gc.collect()
print('Running GBC...')
gbc_results, gbc_result_class = slopestabilityML.GBC.gbc_run(test_results, random_seed)
ml_results['gbc'] = gbc_results
ml_results_class['gbc'] = gbc_result_class
gc.collect()
print('Running SGD...')
sgd_results, sgd_result_class = slopestabilityML.SGD.sgd_run(test_results, random_seed)
ml_results['sgd'] = sgd_results
ml_results_class['sgd'] = sgd_result_class
gc.collect()
print('Running KNN...')
knn_results, knn_result_class = slopestabilityML.KNN.knn_run(test_results, random_seed)
ml_results['KNN'] = knn_results
ml_results_class['knn'] = knn_result_class
gc.collect()
# print('Running KNN...')
# knn_results, knn_result_class = slopestabilityML.KNN.knn_run(test_results, random_seed)
# ml_results['KNN'] = knn_results
#
# ml_results_class['knn'] = knn_result_class
#
# gc.collect()
#
print('Running ADABOOST...')
ada_results, ada_result_class = slopestabilityML.ADABOOST.adaboost_run(test_results, random_seed)
ml_results['ADA'] = ada_results
......@@ -70,14 +70,14 @@ def run_all_tests(test_results):
ml_results_class['ada'] = ada_result_class
gc.collect()
print('Running DNN...')
dnn_results, dnn_result_class = slopestabilityML.DNN.dnn_run(test_results, random_seed)
ml_results['DNN'] = dnn_results
ml_results_class['dnn'] = dnn_result_class
gc.collect()
#
# print('Running DNN...')
# dnn_results, dnn_result_class = slopestabilityML.DNN.dnn_run(test_results, random_seed)
# ml_results['DNN'] = dnn_results
#
# ml_results_class['dnn'] = dnn_result_class
#
# gc.collect()
## CLUSTERS
# print('Running KMeans...')
......
......@@ -145,8 +145,8 @@ def create_data(test_name, test_config, max_depth, *, lambda_param=20, z_weight=
rho_min = np.min(rho_arr)
result_array_norm = np.log10(result_array)
# result_array_norm = slopestabilitytools.normalize(result_array)
#result_array_norm = np.log10(result_array)
result_array_norm = slopestabilitytools.normalize(np.log10(result_array))
labels = slopestabilitytools.classes_labels.numeric2label(classesn)
'''
......
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