|new( [%args] )||
Creates a new perceptron with the following default properties:
Ideally you should use the accessors to set the properties, but for backwards compatability you can still use the following arguments:
The number of elements in W must be equal to the number of inputs plus one. This is because older version of AI::Perceptron combined the threshold and the weights a single list where W was the threshold and W was the first weight. Great idea, eh? :) Thats why its DEPRECATED.
num_inputs( [ $int ] ) Set/get the perceptrons number of inputs. learning_rate( [ $float ] ) Set/get the perceptrons number of inputs. weights( [ \@weights ] ) Set/get the perceptrons weights (floats).
For backwards compatability, returns a list containing the threshold as the first element in list context:
($threshold, @weights) = $p->weights;
This usage is DEPRECATED.
threshold( [ $float ] ) Set/get the perceptrons number of inputs. training_examples( [ \@examples ] ) Set/get the perceptrons list of training examples. This should be a list of arrayrefs of the form:
[ $expected_result => @inputs ]
max_iterations( [ $int ] ) Set/get the perceptrons number of inputs, a negative value implies no maximum.
compute_output( @inputs ) Computes and returns the perceptrons output (either -1 or 1) for the given inputs. See the above model for more details. add_examples( @training_examples ) Adds the @training_examples to to current list of examples. See training_examples() for more details. train( [ @training_examples ] ) Uses the Stochastic Approximation of the Gradient-Descent model to adjust the perceptrons weights until all training examples are classified correctly.
@training_examples can be passed for convenience. These are passed to add_examples(). If you want to re-train the perceptron with an entirely new set of examples, reset the training_examples().
Steve Purkis <email@example.com>
Copyright (c) 1999-2003 Steve Purkis. All rights reserved.
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Machine Learning, by Tom M. Mitchell.
Himanshu Garg <firstname.lastname@example.org> for his bug-report and feedback. Many others for their feedback.
Statistics::LTU, AI::jNeural, AI::NeuralNet::BackProp, AI::NeuralNet::Kohonen
|perl v5.20.3||AI::PERCEPTRON (3)||2016-03-17|