args = parser.parse_args() function = PitzDaily(np=args.np, hpc=args.hpc) features_ranges = np.array( [[4, 6], [20.0, 30.0]]) # List of maximum and minimum values for each parameter query_minimum_spacing = np.array( [0.01, 0.01]) # List of minimum spacing for each parameter n_initial = 9 # Number of initial samples n_queries = 30 # Number of queries plot_regression = True regressor_constructor = regressor_list["gaussian_process_rbf"] regressor = regressor_constructor() query_strategy = probabilistic_std_sampling active_learner_regressor( function, features_ranges, regressor, query_minimum_spacing, n_queries, query_strategy, n_initial, plot_regression=plot_regression, save_path="figs", save_name="pitzdaily", )
("nn_greedyio", "neural_network", greedy_sampling_input_output, 1), ("gp_52_rdm", "gaussian_process_matern52", random_sampling, 1), ) if args.s >= 0: if args.s < len(strategy_list): strategy_list = [strategy_list[args.s]] else: raise ValueError("Invalid strategy index.") for name, regressor_name, query_strategy, repetitions in strategy_list: for n in range(repetitions): np.random.seed(n) regressor_constructor = regressor_list[regressor_name] regressor = regressor_constructor() active_learner_regressor( function, features_ranges, regressor, query_minimum_spacing, n_queries, query_strategy, n_initial, plot_regression=plot_regression, plot_brute_force=plot_brute_force, save_path="figs_" + name, regression_history_path="regression_" + name, save_name="mixer" + "_n{0:03d}".format(n), )
plot_regression = True plot_brute_force = True strategy_list = ( ("gp_rbf_std", "gaussian_process_rbf", probabilistic_std_sampling), ("gp_52_std", "gaussian_process_matern52", probabilistic_std_sampling), ("lin_greedyio", "linear_regression", greedy_sampling_input_output), ("rfr_greedyio", "random_forest_regression", greedy_sampling_input_output), ("svr_greedyio", "svr", greedy_sampling_input_output), ("nn_greedyio", "neural_network", greedy_sampling_input_output), ) for name, regressor_name, query_strategy in strategy_list: regressor_constructor = regressor_list[regressor_name] regressor = regressor_constructor() active_learner_regressor( function, features_ranges, regressor, query_minimum_spacing, n_queries, query_strategy, n_initial, plot_regression=plot_regression, plot_brute_force=plot_brute_force, save_path="figs_" + name, regression_history_path="regression_" + name, save_name="algebraic", )