Пример #1
0
def main(argv):
    try:
        dataset_file = argv[1]
    except IndexError:
        print('Usage:  %s DATASET_FILE' % argv[0], file=sys.stderr)
        return 1

    instances = parsing.parse_dataset_file(dataset_file)
    dataset = Dataset(instances, normalize=True)

    structures = ([dataset.num_inputs()] + hidden + [dataset.num_outputs()]
                  for hidden in HIDDEN_LAYERS)

    for structure in structures:
        for lambda_ in LAMBDAS:
            network = NeuralNetwork(lambda_, structure)
            results = cross_validation(network, dataset, NUM_FOLDS, **PARAMS)
            save_results(RESULTS_DIR, results)
Пример #2
0
def main(argv):
    try:
        dataset_file = argv[1]
    except IndexError:
        print('Usage:  %s DATASET_FILE' % argv[0], file=sys.stderr)
        return 1

    instances = parsing.parse_dataset_file(dataset_file)
    dataset = Dataset(instances, normalize=True)

    n_inputs = dataset.num_inputs()
    n_outputs = dataset.num_outputs()
    structures = ([n_inputs] + hidden_layers + [n_outputs]
                  for hidden_layers in hidden_layer_variations(
                      NUMS_HIDDEN_LAYERS, NUMS_NEURONS_PER_LAYER))

    for network in network_variations(LAMBDAS, structures):
        results = cross_validation(network, dataset, NUM_FOLDS, **PARAMS)
        save_results(RESULTS_DIR, results)