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

Fixed bug with one test being selected multiple times for prediction.

Added split_proportion parameter to settings.
Added average line to summary plots.
parent c1f97839
......@@ -13,7 +13,7 @@ def init():
settings = {}
settings['split_proportion'] = 0.75
settings['split_proportion'] = 0.25
# Normalization and classes
settings['norm_class'] = True # True to use normalized classes, False to use class_ids
......
......@@ -8,6 +8,7 @@ Created on 19.01.2021
import settings
import pandas as pd
import numpy as np
def preprocess_data(data_set):
......@@ -25,7 +26,7 @@ def preprocess_data(data_set):
elif settings.settings['use_labels'] is True:
y_train = pd.DataFrame(data_set['LABELS'])
else:
y_train = pd.DataFrame(data_set['CLASS'])
y_train = pd.DataFrame(data_set['CLASS'].to_numpy().astype(int))
if settings.settings['depth'] is False:
x_train = x_train.drop(['Y'], axis='columns')
......
......@@ -22,7 +22,9 @@ def split_dataset(test_names, random_seed, *, proportion=False):
test_number = len(test_names)
test_prediction = random.sample(list(test_names),
k=math.ceil(test_number * proportion))
print('Number of tests used for prediction: '+str(len(test_prediction)))
test_training = slopestabilitytools.set_diff(list(test_names), set(test_prediction))
print('Number of tests used for training: ' + str(len(test_training)))
return sorted(test_training), sorted(test_prediction)
......@@ -75,7 +75,7 @@ def create_data(test_name, test_config, max_depth):
# RUN INVERSION #
k0 = pg.physics.ert.createGeometricFactors(data)
model_inverted = ert_manager.invert(data=data, lam=100, paraDX=0.25, paraMaxCellSize=2, # paraDepth=2 * max_depth,
model_inverted = ert_manager.invert(data=data, lam=20, paraDX=0.25, paraMaxCellSize=2, # paraDepth=2 * max_depth,
quality=34, zPower=0.4)
result_full = ert_manager.inv.model
......@@ -119,6 +119,7 @@ def create_data(test_name, test_config, max_depth):
classesn = slopestabilitytools.assign_classes(slopestabilitytools.normalize(input_model2_array))
# Create sensitivity values
jac = ert_manager.fop.jacobian() #
# Normalization only for visualization!
......
......@@ -12,65 +12,65 @@ import numpy as np
def init():
global test_definitions
test_definitions = {#'hor1_01': {'layer_n': 1, 'rho_values': [[1, 5], [2, 15]], 'layers_pos': np.array([-5])},
# 'hor1_02': {'layer_n': 1, 'rho_values': [[1, 5], [2, 50]], 'layers_pos': np.array([-5])},
# 'hor1_03': {'layer_n': 1, 'rho_values': [[1, 15], [2, 20]], 'layers_pos': np.array([-8])},
# 'hor1_04': {'layer_n': 1, 'rho_values': [[1, 5], [2, 10]], 'layers_pos': np.array([-3])},
# 'hor1_05': {'layer_n': 1, 'rho_values': [[1, 5], [2, 25]], 'layers_pos': np.array([-3])},
# 'hor1_06': {'layer_n': 1, 'rho_values': [[1, 2], [2, 10]], 'layers_pos': np.array([-4])},
# 'hor1_07': {'layer_n': 1, 'rho_values': [[1, 10], [2, 20]], 'layers_pos': np.array([-6])},
# 'hor1_08': {'layer_n': 1, 'rho_values': [[1, 5], [2, 25]], 'layers_pos': np.array([-3])},
# 'hor1_09': {'layer_n': 1, 'rho_values': [[1, 3], [2, 25]], 'layers_pos': np.array([-3])},
# 'hor1_10': {'layer_n': 1, 'rho_values': [[1, 5], [2, 25]], 'layers_pos': np.array([-7])},
# 'hor1_11': {'layer_n': 1, 'rho_values': [[1, 10], [2, 12]], 'layers_pos': np.array([-4])},
# 'hor1_12': {'layer_n': 1, 'rho_values': [[1, 15], [2, 50]], 'layers_pos': np.array([-5])},
# 'hor1_14': {'layer_n': 1, 'rho_values': [[1, 5], [2, 75]], 'layers_pos': np.array([-5])},
# 'hor1_15': {'layer_n': 1, 'rho_values': [[1, 15], [2, 50]], 'layers_pos': np.array([-8])},
# 'hor1_16': {'layer_n': 1, 'rho_values': [[1, 25], [2, 50]], 'layers_pos': np.array([-5])},
# 'hor1_17': {'layer_n': 1, 'rho_values': [[1, 25], [2, 75]], 'layers_pos': np.array([-5])},
# 'hor1_18': {'layer_n': 1, 'rho_values': [[1, 5], [2, 75]], 'layers_pos': np.array([-8])},
# 'hor1_19': {'layer_n': 1, 'rho_values': [[1, 50], [2, 60]], 'layers_pos': np.array([-7])},
test_definitions = {'hor1_01': {'layer_n': 1, 'rho_values': [[1, 5], [2, 15]], 'layers_pos': np.array([-5])},
'hor1_02': {'layer_n': 1, 'rho_values': [[1, 5], [2, 50]], 'layers_pos': np.array([-5])},
'hor1_03': {'layer_n': 1, 'rho_values': [[1, 15], [2, 20]], 'layers_pos': np.array([-8])},
'hor1_04': {'layer_n': 1, 'rho_values': [[1, 5], [2, 10]], 'layers_pos': np.array([-3])},
'hor1_05': {'layer_n': 1, 'rho_values': [[1, 5], [2, 25]], 'layers_pos': np.array([-3])},
'hor1_06': {'layer_n': 1, 'rho_values': [[1, 2], [2, 10]], 'layers_pos': np.array([-4])},
'hor1_07': {'layer_n': 1, 'rho_values': [[1, 10], [2, 20]], 'layers_pos': np.array([-6])},
'hor1_08': {'layer_n': 1, 'rho_values': [[1, 5], [2, 25]], 'layers_pos': np.array([-3])},
'hor1_09': {'layer_n': 1, 'rho_values': [[1, 3], [2, 25]], 'layers_pos': np.array([-3])},
'hor1_10': {'layer_n': 1, 'rho_values': [[1, 5], [2, 25]], 'layers_pos': np.array([-7])},
'hor1_11': {'layer_n': 1, 'rho_values': [[1, 10], [2, 12]], 'layers_pos': np.array([-4])},
'hor1_12': {'layer_n': 1, 'rho_values': [[1, 15], [2, 50]], 'layers_pos': np.array([-5])},
'hor1_14': {'layer_n': 1, 'rho_values': [[1, 5], [2, 75]], 'layers_pos': np.array([-5])},
'hor1_15': {'layer_n': 1, 'rho_values': [[1, 15], [2, 50]], 'layers_pos': np.array([-8])},
'hor1_16': {'layer_n': 1, 'rho_values': [[1, 25], [2, 50]], 'layers_pos': np.array([-5])},
'hor1_17': {'layer_n': 1, 'rho_values': [[1, 25], [2, 75]], 'layers_pos': np.array([-5])},
'hor1_18': {'layer_n': 1, 'rho_values': [[1, 5], [2, 75]], 'layers_pos': np.array([-8])},
'hor1_19': {'layer_n': 1, 'rho_values': [[1, 50], [2, 60]], 'layers_pos': np.array([-7])},
# 'hor1_20': {'layer_n': 1, 'rho_values': [[1, 2], [2, 10]], 'layers_pos': np.array([-15])},
# Tests with two layers
'hor2_01': {'layer_n': 2, 'rho_values': [[1, 3], [2, 5], [3, 15]],
'layers_pos': np.array([-3, -6])},
'hor2_02': {'layer_n': 2, 'rho_values': [[1, 2], [2, 4], [3, 8]],
'layers_pos': np.array([-4, -8])},
'hor2_03': {'layer_n': 2, 'rho_values': [[1, 4], [2, 15], [3, 25]],
'layers_pos': np.array([-4, -8])},
'hor2_04': {'layer_n': 2, 'rho_values': [[1, 5], [2, 20], [3, 50]],
'layers_pos': np.array([-4, -8])},
'hor2_05': {'layer_n': 2, 'rho_values': [[1, 5], [2, 35], [3, 50]],
'layers_pos': np.array([-4, -8])},
'hor2_06': {'layer_n': 2, 'rho_values': [[1, 5], [2, 35], [3, 50]],
'layers_pos': np.array([-4, -8])},
'hor2_07': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
'layers_pos': np.array([-4, -8])},
'hor2_08': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
'layers_pos': np.array([-3, -9])},
'hor2_09': {'layer_n': 2, 'rho_values': [[1, 3], [2, 40], [3, 70]],
'layers_pos': np.array([-4, -8])},
'hor2_10': {'layer_n': 2, 'rho_values': [[1, 3], [2, 40], [3, 70]],
'layers_pos': np.array([-4, -8])},
'hor2_11': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
'layers_pos': np.array([-3, -15])},
'hor2_12': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
'layers_pos': np.array([-4, -6])},
'hor2_13': {'layer_n': 2, 'rho_values': [[1, 5], [2, 35], [3, 50]],
'layers_pos': np.array([-5, -20])},
'hor2_14': {'layer_n': 2, 'rho_values': [[1, 5], [2, 35], [3, 50]],
'layers_pos': np.array([-3, -5])},
'hor2_15': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
'layers_pos': np.array([-5, -15])},
'hor2_16': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
'layers_pos': np.array([-3, -15])},
'hor2_17': {'layer_n': 2, 'rho_values': [[1, 2], [2, 4], [3, 8]],
'layers_pos': np.array([-4, -15])},
'hor2_18': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 15]],
'layers_pos': np.array([-3, -15])},
'hor2_19': {'layer_n': 2, 'rho_values': [[1, 15], [2, 20], [3, 30]],
'layers_pos': np.array([-3, -15])},
'hor2_20': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
'layers_pos': np.array([-3, -10])},
# 'hor2_01': {'layer_n': 2, 'rho_values': [[1, 3], [2, 5], [3, 15]],
# 'layers_pos': np.array([-3, -6])},
# 'hor2_02': {'layer_n': 2, 'rho_values': [[1, 2], [2, 4], [3, 8]],
# 'layers_pos': np.array([-4, -8])},
# 'hor2_03': {'layer_n': 2, 'rho_values': [[1, 4], [2, 15], [3, 25]],
# 'layers_pos': np.array([-4, -8])},
# 'hor2_04': {'layer_n': 2, 'rho_values': [[1, 5], [2, 20], [3, 50]],
# 'layers_pos': np.array([-4, -8])},
# 'hor2_05': {'layer_n': 2, 'rho_values': [[1, 5], [2, 35], [3, 50]],
# 'layers_pos': np.array([-4, -8])},
# 'hor2_06': {'layer_n': 2, 'rho_values': [[1, 5], [2, 35], [3, 50]],
# 'layers_pos': np.array([-4, -8])},
# 'hor2_07': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
# 'layers_pos': np.array([-4, -8])},
# 'hor2_08': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
# 'layers_pos': np.array([-3, -9])},
# 'hor2_09': {'layer_n': 2, 'rho_values': [[1, 3], [2, 40], [3, 70]],
# 'layers_pos': np.array([-4, -8])},
# 'hor2_10': {'layer_n': 2, 'rho_values': [[1, 3], [2, 40], [3, 70]],
# 'layers_pos': np.array([-4, -8])},
# 'hor2_11': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
# 'layers_pos': np.array([-3, -15])},
# 'hor2_12': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
# 'layers_pos': np.array([-4, -6])},
# 'hor2_13': {'layer_n': 2, 'rho_values': [[1, 5], [2, 35], [3, 50]],
# 'layers_pos': np.array([-5, -20])},
# 'hor2_14': {'layer_n': 2, 'rho_values': [[1, 5], [2, 35], [3, 50]],
# 'layers_pos': np.array([-3, -5])},
# 'hor2_15': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
# 'layers_pos': np.array([-5, -15])},
# 'hor2_16': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
# 'layers_pos': np.array([-3, -15])},
# 'hor2_17': {'layer_n': 2, 'rho_values': [[1, 2], [2, 4], [3, 8]],
# 'layers_pos': np.array([-4, -15])},
# 'hor2_18': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 15]],
# 'layers_pos': np.array([-3, -15])},
# 'hor2_19': {'layer_n': 2, 'rho_values': [[1, 15], [2, 20], [3, 30]],
# 'layers_pos': np.array([-3, -15])},
# 'hor2_20': {'layer_n': 2, 'rho_values': [[1, 5], [2, 10], [3, 70]],
# 'layers_pos': np.array([-3, -10])}
}
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