def get_approximate_options(n, m, methods, losses): #X, y = load_boston(return_X_y=True) #x = X[:100] #x_validate = X[420:] x = [[y] * m for y in range(1, 25)] x_validate = [[y + 0.5] * m for y in range(0, 25)] #x = [[y] * m for y in range(1, 101)] #x_validate = [[y + 0.5] * m for y in range(0, 100)] #X, y = load_diabetes(return_X_y=True) #x = X[:50] #x_validate = X[400:] options = [] for method in methods: options.append({ "x": [convert_variables_without_trainable(x_tmp) for x_tmp in x], "x_validate": [ convert_variables_without_trainable(x_tmp) for x_tmp in x_validate ], "params": convert_variables([1 for x in range(n)]), "loss_function": losses, "opt": method, "eps": 0.0001, "max_steps": 100, }) return options
from utils.generate_data import generate_x from utils.utils import convert_variables, convert_variables_without_trainable from utils.generate_data import generate_set from sklearn.datasets import load_boston X, y = load_boston(return_X_y=True) x = X[:100] x_validate = X[420:] approximate_options9_3 = [ { "x": [convert_variables_without_trainable(x_tmp) for x_tmp in x], "x_validate": [convert_variables_without_trainable(x_tmp) for x_tmp in x_validate], "params": convert_variables([5 for x in range(79)]), "loss_function": tf.keras.losses.MSE, "opt": tf.keras.optimizers.SGD(learning_rate=1), "eps": 0.0001, "max_steps": 30, }, { "x": [convert_variables_without_trainable(x_tmp) for x_tmp in x], "x_validate": [convert_variables_without_trainable(x_tmp) for x_tmp in x_validate], "params": convert_variables([5 for x in range(79)]), "loss_function": tf.keras.losses.MSE, "opt": tf.keras.optimizers.SGD(learning_rate=0.1), "eps": 0.0001, "max_steps": 30,
import tensorflow as tf from utils.utils import convert_variables, convert_variables_without_trainable """ Approximate options """ approximate_options2 = [ { "x": [ convert_variables_without_trainable([x, x]) for x in range(-10, 10, 1) ], "x_validate": [ convert_variables_without_trainable([x, x]) for x in range(-11, 10, 1) ], "params": convert_variables([1 for x in range(11)]), "loss_function": tf.keras.losses.MAE, "opt": tf.keras.optimizers.Adam(learning_rate=0.001), "eps": 0.0001, "max_steps": 1000, }, { "x": [ convert_variables_without_trainable([x, x])
def __init__(self): self.val = {} X, y = load_diabetes(return_X_y=True) for k, v in zip(X, y): self.val[str(convert_variables_without_trainable(k))] = v
import numpy as np import tensorflow as tf from utils.utils import convert_variables, convert_variables_without_trainable """ Approximate options """ approximate_options1 = [ { "x": [convert_variables_without_trainable([x, x]) for x in list(np.arange(0, 5, 0.2))], "x_validate": [convert_variables_without_trainable([x, x]) for x in list(np.arange(0.1, 5, 0.02))], "params": convert_variables([1 for x in range(11)]), "loss_function": tf.keras.losses.MAE, "opt": tf.keras.optimizers.Adam(learning_rate=0.001), "eps": 0.0001, "max_steps": 1000, }, { "x": [convert_variables_without_trainable([x, x]) for x in list(np.arange(0, 5, 0.2))], "x_validate": [convert_variables_without_trainable([x, x]) for x in list(np.arange(0.1, 5, 0.02))], "params": convert_variables([1 for x in range(11)]), "loss_function": tf.keras.losses.MAE, "opt": tf.keras.optimizers.Adam(learning_rate=0.01), "eps": 0.0001, "max_steps": 10000, }, { "x": [convert_variables_without_trainable([x, x]) for x in list(np.arange(0, 5, 0.2))], "x_validate": [convert_variables_without_trainable([x, x]) for x in list(np.arange(0.1, 5, 0.02))],