|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.trees.m5.PreConstructedLinearModel
This class encapsulates a linear regression function. It is a classifier but does not learn the function itself, instead it is constructed with coefficients and intercept obtained elsewhere. The buildClassifier method must still be called however as this stores a copy of the training data's header for use in printing the model to the console.
Constructor Summary | |
PreConstructedLinearModel(double[] coeffs,
double intercept)
Constructor |
Method Summary | |
void |
buildClassifier(Instances instances)
Builds the classifier. |
double |
classifyInstance(Instance inst)
Predicts the class of the supplied instance using the linear model. |
double[] |
coefficients()
Return the array of coefficients |
double |
intercept()
Return the intercept |
int |
numParameters()
Return the number of parameters (coefficients) in the linear model |
java.lang.String |
toString()
Returns a textual description of this linear model |
Methods inherited from class weka.classifiers.Classifier |
debugTipText, distributionForInstance, forName, getDebug, getOptions, listOptions, makeCopies, setDebug, setOptions |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PreConstructedLinearModel(double[] coeffs, double intercept)
coeffs
- an array of coefficientsintercept
- the interceptMethod Detail |
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- an Instances
value
java.lang.Exception
- if an error occurspublic double classifyInstance(Instance inst) throws java.lang.Exception
classifyInstance
in class Classifier
inst
- the instance to make a prediction for
java.lang.Exception
- if an error occurspublic int numParameters()
public double[] coefficients()
public double intercept()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London