InputType
- Type of input using the regressionOutputType
- Type of outputs from the regressionFunctionType
- TYpe of Evaluator that maps the InputType to the OutputTypepublic abstract class AbstractLogisticRegression<InputType,OutputType,FunctionType extends Evaluator<? super InputType,OutputType>> extends AbstractAnytimeSupervisedBatchLearner<InputType,OutputType,FunctionType>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ITERATIONS
Default number of iterations before stopping, 100
|
static double |
DEFAULT_REGULARIZATION
Default regularization, 0.0.
|
static double |
DEFAULT_TOLERANCE
Default tolerance change in weights before stopping, 1.0E-10
|
protected FunctionType |
objectToOptimize
The object to optimize, used as a factory on successive runs of the
algorithm.
|
protected double |
regularization
L2 ridge regularization term, must be nonnegative, a value of zero is
equivalent to unregularized regression.
|
protected FunctionType |
result
Return value from the algorithm
|
protected double |
tolerance
Tolerance change in weights before stopping
|
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
AbstractLogisticRegression(double regularization,
double tolerance,
int maxIterations)
Creates a new instance of AbstractLogisticRegression
|
Modifier and Type | Method and Description |
---|---|
AbstractLogisticRegression<InputType,OutputType,FunctionType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
FunctionType |
getObjectToOptimize()
Getter for objectToOptimize
|
double |
getRegularization()
Getter for regularization
|
FunctionType |
getResult()
Gets the current result of the algorithm.
|
double |
getTolerance()
Getter for tolerance
|
void |
setObjectToOptimize(FunctionType objectToOptimize)
Setter for objectToOptimize
|
void |
setRegularization(double regularization)
Setter for regularization
|
void |
setTolerance(double tolerance)
Setter for tolerance
|
cleanupAlgorithm, getData, getKeepGoing, initializeAlgorithm, learn, setData, setKeepGoing, step, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
learn
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid
public static final int DEFAULT_MAX_ITERATIONS
public static final double DEFAULT_TOLERANCE
public static final double DEFAULT_REGULARIZATION
protected FunctionType extends Evaluator<? super InputType,OutputType> objectToOptimize
protected FunctionType extends Evaluator<? super InputType,OutputType> result
protected double tolerance
protected double regularization
public AbstractLogisticRegression(double regularization, double tolerance, int maxIterations)
regularization
- L2 ridge regularization term, must be nonnegative, a value of zero is
equivalent to unregularized regression.tolerance
- Tolerance change in weights before stoppingmaxIterations
- Maximum number of iterations before stoppingpublic AbstractLogisticRegression<InputType,OutputType,FunctionType> clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends InputOutputPair<? extends InputType,OutputType>>,FunctionType extends Evaluator<? super InputType,OutputType>>
public FunctionType getObjectToOptimize()
public void setObjectToOptimize(FunctionType objectToOptimize)
objectToOptimize
- The object to optimize, used as a factory on successive runs of the
algorithm.public FunctionType getResult()
AnytimeAlgorithm
public double getTolerance()
public void setTolerance(double tolerance)
tolerance
- Tolerance change in weights before stopping, must be nonnegative.public double getRegularization()
public void setRegularization(double regularization)
regularization
- L2 ridge regularization term, must be nonnegative, a value of zero is
equivalent to unregularized regression.