public abstract class StochasticSTLinearL1 extends Object implements Classifier, Regressor, Parameterized, SingleWeightVectorModel
Modifier and Type | Class and Description |
---|---|
static class |
StochasticSTLinearL1.Loss |
Modifier and Type | Field and Description |
---|---|
protected double |
bias
The bias term to add
|
static int |
DEFAULT_EPOCHS |
static StochasticSTLinearL1.Loss |
DEFAULT_LOSS |
static double |
DEFAULT_REG |
protected int |
epochs
The number of training iterations
|
protected double |
lambda
The regularization penalty
|
protected StochasticSTLinearL1.Loss |
loss
The loss function to use
|
protected double |
maxScaled
The scaled maximum
|
protected double |
minScaled
The scaled minimum
|
protected double[] |
obvMax
The maximum observed value for each feature
|
protected double[] |
obvMin
The minimum observed value for each feature
|
protected boolean |
reScale
Whether or not to perform feature rescaling
|
protected Vec |
w
The final weight vector
|
Constructor and Description |
---|
StochasticSTLinearL1() |
Modifier and Type | Method and Description |
---|---|
abstract StochasticSTLinearL1 |
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 |
getEpochs()
Returns the number of iterations of updating that will be done
|
double |
getLambda()
Returns the amount of regularization to used in training
|
StochasticSTLinearL1.Loss |
getLoss()
returns the loss function in use
|
double |
getMaxScaled()
Returns the maximum feature value after scaling
|
double |
getMinScaled()
Returns the minimum feature value after scaling
|
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 |
getW()
Returns a copy of the weight vector used to compute results via a dot
product.
|
Vec |
getWRaw()
Returns the weight vector used to compute results via a dot product.
|
boolean |
isReScale()
Returns if scaling is in use
|
int |
numWeightsVecs()
Returns the number of weight vectors that can be returned.
|
void |
setEpochs(int epochs)
Sets the number of iterations of training that will be performed.
|
void |
setLambda(double lambda)
Sets the regularization constant used for learning.
|
void |
setLoss(StochasticSTLinearL1.Loss loss)
Sets the loss function to use.
|
void |
setMaxScaled(double maxFeature)
Sets the maximum value of any feature after scaling is applied.
|
void |
setMinScaled(double minFeature)
Sets the minimum value of any feature after scaling is applied.
|
void |
setReScale(boolean reScale)
Sets whether or not scaling should be applied on th feature values of the
training vectors.
|
protected double |
wDot(Vec x)
Computes
w .Vec.dot(jsat.linear.Vec) x and does
so by rescaling x as needed automatically and efficiently, even
if x is sparse. |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
classify, supportsWeightedData, trainC, trainC
regress, supportsWeightedData, train, train
protected int epochs
protected double lambda
protected StochasticSTLinearL1.Loss loss
protected Vec w
protected double bias
protected double[] obvMin
protected double[] obvMax
protected boolean reScale
protected double minScaled
protected double maxScaled
public static final int DEFAULT_EPOCHS
public static final double DEFAULT_REG
public static final StochasticSTLinearL1.Loss DEFAULT_LOSS
public abstract StochasticSTLinearL1 clone()
public void setEpochs(int epochs)
epochs
- the number of iterationspublic double getEpochs()
public void setMaxScaled(double maxFeature)
maxFeature
- the maximum feature value after scalingpublic double getMaxScaled()
public void setMinScaled(double minFeature)
minFeature
- the minimum feature value after scalingpublic double getMinScaled()
public void setLambda(double lambda)
lambda
- the regularization to applypublic double getLambda()
public void setLoss(StochasticSTLinearL1.Loss loss)
loss
- the loss function to usepublic StochasticSTLinearL1.Loss getLoss()
public void setReScale(boolean reScale)
FailedToFitException
could occur.
reScale
- whether or not to rescale feature valuespublic boolean isReScale()
protected double wDot(Vec x)
w
.Vec.dot(jsat.linear.Vec)
x and does
so by rescaling x as needed automatically and efficiently, even
if x is sparse.x
- the value to compute the dot product withpublic Vec getWRaw()
public Vec getW()
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 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 obtainCopyright © 2017. All rights reserved.