Esempio n. 1
0
settings            = {
    # Required settings
    "n_inputs"              : 2,       # Number of network input signals
    "layers"                : [  (5, tanh_function), (1, sigmoid_function) ],
                                        # [ (number_of_neurons, activation_function) ]
                                        # The last pair in the list dictate the number of output signals
    
    # Optional settings
    "weights_low"           : -0.1,     # Lower bound on the initial weight value
    "weights_high"          : 0.1,      # Upper bound on the initial weight value
}


# initialize the neural network
network             = NeuralNet( settings )
network.check_gradient( training_data, cost_function )



## load a stored network configuration
# network           = NeuralNet.load_network_from_file( "network0.pkl" )


## Train the network using backpropagation
#backpropagation(
#        network,                        # the network to train
#        training_data,                  # specify the training set
#        test_data,                      # specify the test set
#        cost_function,                  # specify the cost function to calculate error
#        ERROR_LIMIT          = 1e-3,    # define an acceptable error limit 
#        #max_iterations      = 100,     # continues until the error limit is reach if this argument is skipped