Skip to content

Getting "nan" error #28

@NourO93

Description

@NourO93

I am trying to implement a simple example with scaled conjugate gradient. This is my code

`
dataset = [Instance( [0,0], [0] ), Instance( [1,0], [1] ), Instance( [0,1], [1] ), Instance( [1,1], [0] )]
settings = {
"n_inputs" : 2,
"layers" : [ (2, sigmoid_function), (1, sigmoid_function) ]
}

network        = NeuralNet( settings )
training_set   = dataset
test_set       = dataset
cost_function  = cross_entropy_cost

scaled_conjugate_gradient(
# Required parameters
network,                     # the neural network instance to train
training_set,                # the training dataset
test_set,                    # the test dataset
cost_function,               # the cost function to optimize

# Optional parameters
ERROR_LIMIT          = 1e-3, # Error tolerance when terminating the learning
max_iterations       = (),   # Regardless of the achieved error, terminate after max_iterations epochs. Default: infinite
print_rate           = 1000, # The epoch interval to print progression statistics
save_trained_network = False # Whether to ask the user if they would like to save the network after training
)

`

The output at each epoch looks something like this:

[training] Current error: nan Epoch: 1000

It never changed from nan and I can't figure out why

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions