Esempio n. 1
0
        attrs.append(row[1:])

if __name__ == '__main__':
    print "Parsing the training dataset..."
    # parse the training dataset and store its information into globals
    parse_data('mushroom-training.txt')

    # set up the layers to be used
    x = Layer(6, attrs[curr_point], 1)
    y = Layer(1, x.layer_out, 2)

    print "Begining training the neural network:"
    # iterate through to train the neural network
    while total_runs < NUM_TRAINING_ITERATIONS:
        # set the new input values
        x.input_vals = attrs[curr_point]

        # set up the first layer and evaluate it
        x.input_vals = attrs[curr_point]
        x.eval()

        # set up the second layer and evaluate it
        y.input_vals = x.layer_out
        y.eval()

        # backpropogate
        y.backprop(target[curr_point])
        x.backprop(y)

        # get the current error
        curr_err = err(y.layer_out[0], target[curr_point])