def objective(us: [float]) -> float:
        model, user_search_params, info = embedding(us, n_input)
        info['global_optimizer'] = global_optimizer.__name__
        info['embedding_name']=embedding_name

        print('  ')
        print(model.summary())
        search_params = {'epochs':2000,'patience':50,'jiggle_fraction':0.1,'symmetries':None}
        search_params.update(user_search_params)
        pprint(search_params)
        model, metrics, test_error_ratio = challenge(model=model, skater_name=skater_name, k=k, n_real=60, n_samples=150, n_warm=100, n_input=n_input,
                                                     with_metrics=True, verbose=1, info=info, **search_params)
        return metrics['test_error']

def build_challenger_model(n_inputs):
    model = keras.Sequential()
    kernel_initializer_0 = keras.initializers.RandomUniform(minval=0.01,
                                                            maxval=0.02,
                                                            seed=None)
    bias_initializer_0 = keras.initializers.RandomUniform(minval=0.01,
                                                          maxval=0.21,
                                                          seed=None)
    model.add(
        keras.layers.Dense(80,
                           activation="linear",
                           input_shape=(1, n_inputs),
                           kernel_initializer=kernel_initializer_0,
                           bias_initializer=bias_initializer_0))
    model.add(keras.layers.Dense(16, activation='linear'))
    model.add(keras.layers.Dense(1, activation="linear"))
    optimizer = keras.optimizers.Adagrad(learning_rate=0.005)
    model.compile(loss='mse', optimizer=optimizer)
    return model


if __name__ == '__main__':
    skater_name = __file__.split(os.path.sep)[-1].replace('challenge_',
                                                          '').replace(
                                                              '.py', '')
    print(skater_name)
    model = build_challenger_model(n_inputs=80)
    challenge(model=model, skater_name=skater_name, epochs=5000, patience=50)
Beispiel #3
0
    model.add(keras.layers.Dense(6, activation="linear"))
    model.add(keras.layers.Dense(8, activation="linear"))
    model.add(keras.layers.Dense(1, activation="linear"))
    optimizer = keras.optimizers.RMSprop(learning_rate=0.001)
    model.add(keras.layers.Dropout(0.01))
    model.compile(loss='mse', optimizer=optimizer)
    # y = model(ones((1, n_inputs)))
    return model

suggestion = """
def build_last_value_champion_model(n_inputs):
  model = keras.Sequential()
  model.add(keras.layers.Dense(8, activation="linear", input_shape=(1,n_inputs)))
  model.add(keras.layers.Dense(6, activation="relu"))
  model.add(keras.layers.Dense(8, activation="linear"))
  model.add(keras.layers.Dense(1, activation="linear"))
  model.compile(loss='mse')
  #y = model(ones((1, n_inputs)))
  return model"""

champ = """
     
"""


if __name__=='__main__':
    skater_name = __file__.split(os.path.sep)[-1].replace('challenge_','').replace('.py','')
    print(skater_name)
    model = build_challenger_model(n_inputs=80)
    challenge(model=model, skater_name=skater_name, epochs=50,  jiggle_fraction=0.05)
    model.add(keras.layers.Dense(2, activation="tanh"))  # selu
    model.add(keras.layers.Dense(1, activation="linear"))
    optimizer = keras.optimizers.Adagrad(learning_rate=0.005)
    model.compile(loss='mse', optimizer=optimizer)
    return model


champ = """
def champion_model(n_inputs):
    model = keras.Sequential()
    kernel_initializer_0 = keras.initializers.RandomUniform(minval=0.01, maxval=0.02, seed=None)
    bias_initializer_0 = keras.initializers.RandomUniform(minval=0.01, maxval=0.21, seed=None)
    model.add(keras.layers.Dense(80, activation="linear", input_shape=(1, n_inputs),
                                 kernel_initializer=kernel_initializer_0,
                                 bias_initializer=bias_initializer_0))
    model.add(keras.layers.Dense(16, activation='softsign'))
    model.add(keras.layers.Dense(2, activation="tanh"))  # selu
    model.add(keras.layers.Dense(1, activation="linear"))
    optimizer = keras.optimizers.Adagrad(learning_rate=0.005)
    model.compile(loss='mse', optimizer=optimizer)
    return model
    """

if __name__ == '__main__':
    skater_name = __file__.split(os.path.sep)[-1].replace('challenge_',
                                                          '').replace(
                                                              '.py', '')
    print(skater_name)
    model = build_challenger_model(n_inputs=80)
    challenge(model=model, skater_name=skater_name, epochs=500)
    model.add(keras.layers.Dense(1, activation="linear"))
    optimizer = keras.optimizers.RMSprop(learning_rate=0.001)
    model.compile(loss='mse', optimizer=optimizer)
    return model


champ = """def build_challenger_model(n_inputs):
    model = keras.Sequential()
    kernel_initializer_0 = keras.initializers.RandomUniform(minval=0.01, maxval=0.02, seed=None)
    bias_initializer_0 = keras.initializers.RandomUniform(minval=0.01, maxval=0.21, seed=None)
    model.add(keras.layers.Dense(80, activation="linear", input_shape=(1, n_inputs),
                                 kernel_initializer=kernel_initializer_0,
                                 bias_initializer=bias_initializer_0))
    model.add(keras.layers.Dense(16, activation='linear'))
    model.add(keras.layers.Dense(2, activation="linear"))  # selu
    model.add(keras.layers.Dense(1, activation="linear"))
    optimizer = keras.optimizers.Adagrad(learning_rate=0.005)
    model.compile(loss='mse', optimizer=optimizer)
    return model"""

if __name__ == '__main__':
    skater_name = __file__.split(os.path.sep)[-1].replace('challenge_',
                                                          '').replace(
                                                              '.py', '')
    print(skater_name)
    model = build_challenger_model(n_inputs=80)
    challenge(model=model,
              skater_name=skater_name,
              epochs=5000,
              patience=50,
              jiggle_fraction=0.2)
from sklearned.challenging.surrogatechallenge import challenge
from tensorflow import keras
import os


def build_challenger_model(n_inputs):
    model = keras.Sequential()
    kernel_initializer_0 = keras.initializers.RandomUniform(minval=0.01, maxval=0.1, seed=None)
    bias_initializer_0 = keras.initializers.RandomUniform(minval=-0.2, maxval=0.2, seed=None)
    model.add(keras.layers.Dense(80, activation="linear", input_shape=(1, n_inputs),
                                 kernel_initializer=kernel_initializer_0,
                                 bias_initializer=bias_initializer_0))
    model.add(keras.layers.Dense(16, activation='linear'))
    model.add(keras.layers.Dense(2, activation="linear"))  # selu
    model.add(keras.layers.Dense(1, activation="linear"))
    optimizer = keras.optimizers.RMSprop(learning_rate=0.001)
    model.compile(loss='mse', optimizer=optimizer)
    return model


if __name__=='__main__':
    skater_name = __file__.split(os.path.sep)[-1].replace('challenge_','').replace('.py','')
    print(skater_name)
    model = build_challenger_model(n_inputs=80)
    challenge(model=model, skater_name=skater_name, epochs=5, patience=25)