def load_franke_data(self, cfg: CN, perm_index): x, y, z = create_frankie_data(cfg.SEED, cfg.DATA.FRANKIE.N, cfg.DATA.FRANKIE.NOISE) X = create_X(x, y, cfg.DATA.FRANKIE.P) self.split_and_scale_train_test(X, z, perm_index, test_size=cfg.TEST_SIZE) return self
def create_test_data(): seed = 3155 N = 20 noise_strength = 0.1 p = 5 x, y, z = create_frankie_data(seed, N, noise_strength) X = create_X(x, y, p) return X, z
# Cross valid and bootstrap for different alphas N = 40 noise = 0.3 p = 4 alphas = [0.0, 0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 1.0, 10.0, 100.0] l = len(alphas) trials = 1000 sample_count = N kfolds = 5 x, y, z = create_frankie_data(SEED, N, noise_strength=noise) perm_index = np.random.permutation(len(z)) mse_boot = np.zeros(l) mse_kfold = np.zeros(l) mse_boot_train = np.zeros(l) mse_kfold_train = np.zeros(l) bias_boot = np.zeros(l) var_boot = np.zeros(l) for i in range(len(alphas)): progressBar(i + 1, l) X = create_X(x, y, p, debug=False) crossval = CrossValidationKFold(kfolds).train_and_test(