import os import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable from erinn.python.utils.io_utils import read_pkl, read_config_file config_file = os.path.join('..', 'config', 'config.yml') preprocess_dir = 'noise_10' train_dir = os.path.join('..', 'data', preprocess_dir, 'train') valid_dir = os.path.join('..', 'data', preprocess_dir, 'valid') test_dir = os.path.join('..', 'data', preprocess_dir, 'test') config = read_config_file(config_file) iterator_train = os.scandir(train_dir) iterator_valid = os.scandir(valid_dir) iterator_test = os.scandir(test_dir) num = 2 # inspired by https://joseph-long.com/writing/colorbars/ params = { 'image.origin': 'upper', 'image.interpolation': 'nearest', 'image.cmap': 'jet', 'axes.grid': False, 'savefig.dpi': 150, # to adjust notebook inline plot size 'axes.labelsize': 8, # fontsize for x and y labels (was 10) 'axes.titlesize': 8, 'font.size': 8, # was 10 'legend.fontsize': 6, # was 10
from sklearn.externals import joblib from erinn.python.utils.io_utils import read_pkl, read_config_file #%% setting # io train_dir = '../data/raw_data/train' test_dir = '../data/raw_data/train' # random forest num_train = 1000 num_test = 100 num_cpu = os.cpu_count() num_tree = 3 random_seed = 42 # plot config = read_config_file('../config/config.yml') nx = config['nx'] nz = config['nz'] limit = 5 #%% Read data X_train = np.array([], dtype='float64') y_train = np.array([], dtype='float64') X_test = np.array([], dtype='float64') y_test = np.array([], dtype='float64') for i in range(num_train): filename = os.path.join(train_dir, f'raw_data_{i+1}.pkl') print(filename) data = read_pkl(filename) X_train = np.vstack(