public class Perceptron extends AbstractClassifier implements Regressor
Modifier and Type | Field and Description |
---|---|
protected double |
accumulatedError |
FlagOption |
constantLearningRatioDecayOption |
protected double |
fadingFactor |
FloatOption |
fadingFactorOption |
protected boolean |
initialisePerceptron |
protected double |
learningRateDecay |
FloatOption |
learningRateDecayOption |
protected double |
learningRatio |
FloatOption |
learningRatioOption |
DoubleVector |
perceptronattributeStatistics |
protected int |
perceptronInstancesSeen |
protected double |
perceptronsumY |
protected int |
perceptronYSeen |
DoubleVector |
squaredperceptronattributeStatistics |
protected double |
squaredperceptronsumY |
protected double[] |
weightAttribute |
classifierRandom, modelContext, randomSeed, randomSeedOption, trainingWeightSeenByModel
classOptionNamesToPreparedObjects, options
Constructor and Description |
---|
Perceptron() |
Perceptron(Perceptron p) |
Modifier and Type | Method and Description |
---|---|
double |
computeSD(double squaredVal,
double val,
int size) |
double |
getCurrentError() |
int |
getInstancesSeen() |
void |
getModelDescription(StringBuilder out,
int indent)
Returns a string representation of the model.
|
protected Measurement[] |
getModelMeasurementsImpl()
Gets the current measurements of this classifier.
The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. |
double[] |
getVotesForInstance(weka.core.Instance inst)
Predicts the class memberships for a given instance.
|
double[] |
getWeights() |
boolean |
isRandomizable()
Gets whether this classifier needs a random seed.
|
double[] |
normalizedInstance(weka.core.Instance inst) |
double |
normalizedPrediction(weka.core.Instance inst) |
void |
normalizeWeights() |
double |
prediction(double[] instanceValues) |
void |
reset() |
void |
resetError() |
void |
resetLearningImpl()
A method to reset the model
|
void |
setInstancesSeen(int pInstancesSeen) |
void |
setLearningRatio(double learningRatio) |
void |
setWeights(double[] w) |
void |
trainOnInstanceImpl(weka.core.Instance inst)
Update the model using the provided instance
|
double |
updateWeights(weka.core.Instance inst,
double learningRatio) |
contextIsCompatible, copy, correctlyClassifies, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getModelContext, getModelMeasurements, getNominalValueString, getPurposeString, getSubClassifiers, modelAttIndexToInstanceAttIndex, modelAttIndexToInstanceAttIndex, prepareForUseImpl, resetLearning, setModelContext, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance
discoverOptionsViaReflection, getCLICreationString, getOptions, getPreparedClassOption, getPreparedClassOption, prepareClassOptions, prepareForUse, prepareForUse
copy, measureByteSize, measureByteSize, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCLICreationString, getOptions, prepareForUse, prepareForUse
measureByteSize
public FlagOption constantLearningRatioDecayOption
public FloatOption learningRatioOption
public FloatOption learningRateDecayOption
public FloatOption fadingFactorOption
protected double fadingFactor
protected double learningRatio
protected double learningRateDecay
protected double[] weightAttribute
public DoubleVector perceptronattributeStatistics
public DoubleVector squaredperceptronattributeStatistics
protected int perceptronInstancesSeen
protected int perceptronYSeen
protected double accumulatedError
protected boolean initialisePerceptron
protected double perceptronsumY
protected double squaredperceptronsumY
public Perceptron()
public Perceptron(Perceptron p)
public void setWeights(double[] w)
public double[] getWeights()
public int getInstancesSeen()
public void setInstancesSeen(int pInstancesSeen)
public void resetLearningImpl()
resetLearningImpl
in class AbstractClassifier
public void reset()
public void resetError()
public void trainOnInstanceImpl(weka.core.Instance inst)
trainOnInstanceImpl
in class AbstractClassifier
inst
- the instance to be used for trainingpublic double normalizedPrediction(weka.core.Instance inst)
public double prediction(double[] instanceValues)
public double[] normalizedInstance(weka.core.Instance inst)
public double computeSD(double squaredVal, double val, int size)
public double updateWeights(weka.core.Instance inst, double learningRatio)
public void normalizeWeights()
public boolean isRandomizable()
Classifier
isRandomizable
in interface Classifier
public double[] getVotesForInstance(weka.core.Instance inst)
Classifier
getVotesForInstance
in interface Classifier
inst
- the instance to be classifiedprotected Measurement[] getModelMeasurementsImpl()
AbstractClassifier
getModelMeasurementsImpl
in class AbstractClassifier
public void getModelDescription(StringBuilder out, int indent)
AbstractClassifier
getModelDescription
in class AbstractClassifier
out
- the stringbuilder to add the descriptionindent
- the number of characters to indentpublic void setLearningRatio(double learningRatio)
public double getCurrentError()
Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.