public class LogisticRegressionDCD extends Object implements Classifier, Parameterized, SingleWeightVectorModel
Modifier | Constructor and Description |
---|---|
|
LogisticRegressionDCD()
Creates a new Logistic Regression learner that does no more than 100
training iterations with a default regularization tradeoff of C = 1
|
|
LogisticRegressionDCD(double C)
Creates a new Logistic Regression learner that does no more than 100
training iterations.
|
|
LogisticRegressionDCD(double C,
int maxIterations)
Creates a new Logistic Regression learner
|
protected |
LogisticRegressionDCD(LogisticRegressionDCD toCopy)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
Classifier |
clone() |
double |
getBias()
Returns the bias term used for the model, or 0 of the model does not
support or was not trained with a bias term.
|
double |
getBias(int index)
Returns the bias term used with the weight vector for the given class
index.
|
double |
getC()
Returns the regularization tradeoff parameter
|
int |
getMaxIterations()
Returns the maximum number of iterations the algorithm is allowed to run
|
Parameter |
getParameter(String paramName)
Returns the parameter with the given name.
|
List<Parameter> |
getParameters()
Returns the list of parameters that can be altered for this learner.
|
Vec |
getRawWeight()
Returns the only weight vector used for the model
|
Vec |
getRawWeight(int index)
Returns the raw weight vector associated with the given class index.
|
Vec |
getWeightVec()
Returns the weight vector used to compute results via a dot product.
|
static Distribution |
guessC(DataSet d)
Guess the distribution to use for the regularization term
C in Logistic Regression. |
boolean |
isUseBias()
Returns
true if a bias term is in use, false otherwise. |
int |
numWeightsVecs()
Returns the number of weight vectors that can be returned.
|
void |
setC(double C)
Sets the regularization trade-off term.
|
void |
setMaxIterations(int maxIterations)
Sets the maximum number of iterations the algorithm is allowed to run
for.
|
void |
setUseBias(boolean useBias)
Sets whether or not an implicit bias term should be added to the model.
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
public LogisticRegressionDCD()
public LogisticRegressionDCD(double C)
C
- the regularization tradeoff termpublic LogisticRegressionDCD(double C, int maxIterations)
C
- the regularization tradeoff termmaxIterations
- the maximum number of iterations through the data setprotected LogisticRegressionDCD(LogisticRegressionDCD toCopy)
toCopy
- the object to copypublic void setC(double C)
C
- the positive regularization tradeoff valuepublic double getC()
public void setMaxIterations(int maxIterations)
maxIterations
- the maximum number of iterationspublic int getMaxIterations()
public void setUseBias(boolean useBias)
useBias
- true
to add a bias term, false
to exclude
the bias term.public boolean isUseBias()
true
if a bias term is in use, false
otherwise.true
if a bias term is in use, false
otherwise.public Vec getRawWeight()
SingleWeightVectorModel
getRawWeight
in interface SingleWeightVectorModel
public double getBias()
SingleWeightVectorModel
getBias
in interface SingleWeightVectorModel
public Vec getRawWeight(int index)
SimpleWeightVectorModel
ConstantVector
object may be returned. index = 0
should be usedgetRawWeight
in interface SimpleWeightVectorModel
index
- the class index to get the weight vector forpublic double getBias(int index)
SimpleWeightVectorModel
0
will be returned.index = 0
should be usedgetBias
in interface SimpleWeightVectorModel
index
- the class index to get the weight vector forpublic int numWeightsVecs()
SimpleWeightVectorModel
numWeightsVecs
in interface SimpleWeightVectorModel
SimpleWeightVectorModel.getRawWeight(int)
can be called.public CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onpublic boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
public Classifier clone()
clone
in interface Classifier
clone
in class Object
public Vec getWeightVec()
public List<Parameter> getParameters()
Parameterized
getParameters
in interface Parameterized
public Parameter getParameter(String paramName)
Parameterized
getParameter
in interface Parameterized
paramName
- the name of the parameter to obtainpublic static Distribution guessC(DataSet d)
C
in Logistic Regression.d
- the data set to get the guess forCopyright © 2017. All rights reserved.