def make_experiments(system, dataset): x = dataset[["x1", "x2"]].values funcs = {} for col, depvar in zip(("log_conductivity", "solution"), ("log_a", "u")): y = dataset[col].values gp = GP(x, y[:, np.newaxis]) gp.train(num_epochs=1000, learning_rate=0.1) gp.predict_mode() # Extract function # Sorry for the a-kludge :( f = Function(gp.model.get_mean_function()) if depvar == "log_a": # Convert to normal conductivity # TODO make this remain a random function f = f.exp() depvar = "a" funcs[depvar] = f experiments = [ Experiment({ "u": funcs["u"], "a": funcs["a"] }, dataset[["x1", "x2"]]) ] fitness_threshold = ground_truth_fitness(experiments, ground_truth_model) return experiments, fitness_threshold
def make_experiments(system, dataset): x = dataset["x"].values funcs = {} for col, depvar in zip(("conductivity", "solution", "force"), ("a", "u", "f")): y = dataset[col].values gp = GP(x[:, np.newaxis], y[:, np.newaxis]) gp.train(num_epochs=1000, learning_rate=0.1) # , show_loss=True) gp.predict_mode() funcs[depvar] = Function(gp.model.get_mean_function()) experiments = [ Experiment( { "u": funcs["u"], "a": funcs["a"] }, pd.DataFrame({"x": x}), inhomogeneous=funcs["f"], ) ] fitness_threshold = ground_truth_fitness(experiments, ground_truth_model) return experiments, fitness_threshold
def make_experiments(system, dataset): t = dataset["t"].values lhs = {} x = dataset["x"].values gp = GP(t[:, np.newaxis], x[:, np.newaxis]) gp.train(num_epochs=1000, learning_rate=0.1) # , show_loss=True) gp.predict_mode() # Extract function for modeled dataset fx = Function(gp.model.get_mean_function()) experiments = [Experiment({"x": fx}, pd.DataFrame({"t": t}))] # Extras fitness_threshold = ground_truth_fitness(experiments, ground_truth_model) return experiments, fitness_threshold