Пример #1
0
from nas4candle.nasapi.benchmark import Problem
from nas4candle.nasapi.benchmark.nas.linearRegMultiInputs.load_data import load_data
from nas4candle.nasapi.search.nas.model.baseline.anl_mlp_2 import create_structure
from nas4candle.nasapi.search.nas.model.preprocessing import minmaxstdscaler

# We create our Problem object with the Problem class, you don't have to name your Problem object 'Problem' it can be any name you want. You can also define different problems in the same module.
Problem = Problem()

# You define if your problem is a regression problem (the reward will be minus of the mean squared error) or a classification problem (the reward will be the accuracy of the network on the validation set).
Problem.add_dim('regression', True)

# You define how to load your data by giving a 'load_data' function. This function will return your data set following this interface: (train_X, train_y), (valid_X, valid_y). You can also add a 'kwargs' key with arguments for the load_data function.
Problem.add_dim('load_data', {
    'func': load_data,
})

# OPTIONAL : You define a preprocessing function which will be applied on your data before training generated models. This preprocessing function use sklearn preprocessors api.
Problem.add_dim('preprocessing', {
    'func': minmaxstdscaler
})

# You define the create structure function. This function will return an object following the Structure interface. You can also have kwargs arguments such as 'num_cells' for this function.
Problem.add_dim('create_structure', {
    'func': create_structure,
    'kwargs': {
        'num_cells': 5
    }
})

# You define the hyperparameters used to train your generated models during the search.
Problem.add_dim('hyperparameters', {
Пример #2
0
from nas4candle.nasapi.benchmark import Problem
from nas4candle.candle.Uno.models.uno_mlp_small import create_structure

# We create our Problem object with the Problem class, you don't have to name your Problem object 'Problem' it can be any name you want. You can also define different problems in the same module.
Problem = Problem()

# You define the create structure function. This function will return an object following the Structure interface. You can also have kwargs arguments such as 'num_cells' for this function.
Problem.add_dim('create_structure', {
    'func': create_structure,
})

# You define the hyperparameters used to train your generated models during the search.
Problem.add_dim('hyperparameters', {
    'num_epochs': 1,
})

# Just to print your problem, to test its definition and imports in the current python environment.
if __name__ == '__main__':
    print(Problem)
Пример #3
0
from nas4candle.nasapi.benchmark import Problem
from nas4candle.candle.NT3.nt3_baseline_keras2 import load_data
from nas4candle.candle.NT3.models.candle_conv_mlp_baseline import create_structure
#from nas4candle.nasapi.search.nas.model.preprocessing import minmaxstdscaler

# We create our Problem object with the Problem class, you don't have to name your Problem object 'Problem' it can be any name you want. You can also define different problems in the same module.
Problem = Problem()

# You define if your problem is a regression problem (the reward will be minus of the mean squared error) or a classification problem (the reward will be the accuracy of the network on the validation set).
Problem.add_dim('regression', False) # NT3 is a classification problem between 2 classes

# You define how to load your data by giving a 'load_data' function. This function will return your data set following this interface: (train_X, train_y), (valid_X, valid_y). You can also add a 'kwargs' key with arguments for the load_data function.
Problem.add_dim('load_data', {
    'func': load_data,
})

# OPTIONAL : You define a preprocessing function which will be applied on your data before training generated models. This preprocessing function use sklearn preprocessors api.
#Problem.add_dim('preprocessing', {
#    'func': minmaxstdscaler
#})

# You define the create structure function. This function will return an object following the Structure interface. You can also have kwargs arguments such as 'num_cells' for this function.
Problem.add_dim('create_structure', {
    'func': create_structure,
})

# You define the hyperparameters used to train your generated models during the search.
Problem.add_dim('hyperparameters', {
    'batch_size': 20,
    'learning_rate': 0.01,
    'optimizer': 'adam',
Пример #4
0
from nas4candle.nasapi.benchmark import Problem
from nas4candle.candle.Combo.models.candle_mlp_large import create_structure

# We create our Problem object with the Problem class, you don't have to name your Problem object 'Problem' it can be any name you want. You can also define different problems in the same module.
Problem = Problem()

# You define the create structure function. This function will return an object following the Structure interface. You can also have kwargs arguments such as 'num_cells' for this function.
Problem.add_dim('create_structure', {'func': create_structure})

# You define the hyperparameters used to train your generated models during the search.
Problem.add_dim('hyperparameters', {
    'num_epochs': 1,
})

Problem.add_dim('load_data', {'prop': 0.4})

# Just to print your problem, to test its definition and imports in the current python environment.
if __name__ == '__main__':
    print(Problem)
Пример #5
0
# TODO : not ready

from nas4candle.nasapi.search.nas.contrib.google_nas_net import create_structure
from nas4candle.nasapi.benchmark.nas.mnist2D.load_data import load_data
from nas4candle.nasapi.benchmark import Problem

Problem = Problem()
Problem.add_dim('regression', False)
Problem.add_dim('load_data', {
    'func': load_data
})
Problem.add_dim('create_structure', {
    'func': create_structure,
    'kwargs': {}
})
Problem.add_dim('hyperparameters', {
    'batch_size': 100,
    'learning_rate': 0.001,
    'optimizer': 'adam',
    'num_epochs': 50,
    'loss_metric': 'mean_softmax_cross_entropy',
    'test_metric': 'accuracy'
})


if __name__ == '__main__':
    print(Problem)
Пример #6
0
from nas4candle.nasapi.search.nas.model.baseline.anl_mlp_2 import create_structure
from nas4candle.nasapi.benchmark.nas.mnist1D.load_data import load_data
from nas4candle.nasapi.benchmark import Problem

Problem = Problem()

Problem.add_dim('regression', False)

Problem.add_dim('load_data', {'func': load_data})

Problem.add_dim('create_structure', {
    'func': create_structure,
    'kwargs': {
        'num_cells': 5
    }
})

Problem.add_dim(
    'hyperparameters', {
        'batch_size': 64,
        'learning_rate': 0.0001,
        'optimizer': 'adam',
        'num_epochs': 10,
        'loss_metric': 'categorical_crossentropy',
        'metrics': ['acc']
    })

if __name__ == '__main__':
    print(Problem)