update_output = True
subplots = False

if update_output:
    #First, we run our configurations
    import mnist_loader
    training_data, validation_data, test_data = mnist_loader.load_data_wrapper(
    )
    training_data = training_data[:1000]

    import network_dev2

    f = open('{0}_output.txt'.format(comparison_file), 'w').close()

    config_count = 0
    net = network_dev2.Network([784, 30, 10], output_filename=comparison_file)
    net.SGD(
        training_data,
        epochs,  #epochs
        10,  #m
        3.0,  #eta
        5,  #test_accuracy_check_interval
        2,  #eta_decrease_factor
        .9,  #u
        training_data_subsections=training_data_subsections,
        test_data=test_data,
        config_num=config_count,
        run_count=run_count)

    config_count += 1
    net = network_dev2.Network([784, 30, 10], output_filename=comparison_file)
if update_output:
    #First, we run our configurations
    import mnist_loader
    training_data, validation_data, test_data = mnist_loader.load_data_wrapper()

    #If we want to speed up our training or magnify differences for comparisons:
    #Note: will lower accuracy and learning speed.
    training_data = training_data[:1000]

    import network_dev2

    f = open('{0}_output.txt'.format(comparison_file), 'w').close()
    
    config_count = 0
    net = network_dev2.Network([784, 30, 10], output_filename=comparison_file, softmax=False, cost=network_dev2.quadratic_cost, weight_init=network_dev2.large_weight_initializer)
    net.SGD(training_data, 
            epochs, #epochs
            10,#m
            0.5,#eta
            5,#test_accuracy_check_interval
            2,#eta_decrease_factor
            0,#u
            0,#lmbda / regularization rate
            training_data_subsections=training_data_subsections, 
            validation_data=validation_data,
            test_data=test_data,
            early_stopping=early_stopping,
            output_training_cost=output_training_cost,
            output_training_accuracy=output_training_accuracy,
            output_validation_cost=output_validation_cost,
Esempio n. 3
0
    #First, we run our configurations
    import mnist_loader
    training_data, validation_data, test_data = mnist_loader.load_data_wrapper(
    )
    #If we want to speed up our training or magnify differences for comparisons
    #Note: will lower accuracy and learning speed.
    training_data = training_data[:1000]

    import network_dev2

    f = open('{0}_output.txt'.format(comparison_file), 'w').close()

    config_count = 0
    net = network_dev2.Network(
        [784, 30, 10],
        output_filename=comparison_file,
        softmax=False,
        cost=network_dev2.quadratic_cost,
        weight_init=network_dev2.large_weight_initializer)
    net.SGD(
        training_data,
        epochs,  #epochs
        10,  #m
        0.5,  #eta
        5,  #test_accuracy_check_interval
        2,  #eta_decrease_factor
        0,  #u
        0,  #lmbda / regularization rate
        training_data_subsections=training_data_subsections,
        validation_data=validation_data,
        test_data=test_data,
        early_stopping=early_stopping,