public class SVMWithSGD extends GeneralizedLinearAlgorithm<SVMModel> implements scala.Serializable
SVMWithSGD.optimizer
.
NOTE: Labels used in SVM should be {0, 1}.Constructor and Description |
---|
SVMWithSGD()
Construct a SVM object with default parameters: {stepSize: 1.0, numIterations: 100,
regParm: 0.01, miniBatchFraction: 1.0}.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
addIntercept_$eq(boolean x$1) |
protected static boolean |
addIntercept() |
protected SVMModel |
createModel(Vector weights,
double intercept)
Create a model given the weights and intercept
|
protected static Vector |
generateInitialWeights(RDD<LabeledPoint> input) |
static int |
getNumFeatures() |
protected static void |
initializeLogIfNecessary(boolean isInterpreter) |
static boolean |
isAddIntercept() |
protected static boolean |
isTraceEnabled() |
protected static org.slf4j.Logger |
log() |
protected static void |
logDebug(scala.Function0<java.lang.String> msg) |
protected static void |
logDebug(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logError(scala.Function0<java.lang.String> msg) |
protected static void |
logError(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logInfo(scala.Function0<java.lang.String> msg) |
protected static void |
logInfo(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static java.lang.String |
logName() |
protected static void |
logTrace(scala.Function0<java.lang.String> msg) |
protected static void |
logTrace(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logWarning(scala.Function0<java.lang.String> msg) |
protected static void |
logWarning(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
numFeatures_$eq(int x$1) |
protected static int |
numFeatures() |
protected static void |
numOfLinearPredictor_$eq(int x$1) |
protected static int |
numOfLinearPredictor() |
GradientDescent |
optimizer()
The optimizer to solve the problem.
|
static M |
run(RDD<LabeledPoint> input) |
static M |
run(RDD<LabeledPoint> input,
Vector initialWeights) |
static GeneralizedLinearAlgorithm<M> |
setIntercept(boolean addIntercept) |
static GeneralizedLinearAlgorithm<M> |
setValidateData(boolean validateData) |
static SVMModel |
train(RDD<LabeledPoint> input,
int numIterations)
Train a SVM model given an RDD of (label, features) pairs.
|
static SVMModel |
train(RDD<LabeledPoint> input,
int numIterations,
double stepSize,
double regParam)
Train a SVM model given an RDD of (label, features) pairs.
|
static SVMModel |
train(RDD<LabeledPoint> input,
int numIterations,
double stepSize,
double regParam,
double miniBatchFraction)
Train a SVM model given an RDD of (label, features) pairs.
|
static SVMModel |
train(RDD<LabeledPoint> input,
int numIterations,
double stepSize,
double regParam,
double miniBatchFraction,
Vector initialWeights)
Train a SVM model given an RDD of (label, features) pairs.
|
protected static void |
validateData_$eq(boolean x$1) |
protected static boolean |
validateData() |
protected scala.collection.immutable.List<scala.Function1<RDD<LabeledPoint>,java.lang.Object>> |
validators() |
addIntercept, generateInitialWeights, getNumFeatures, isAddIntercept, numFeatures, numOfLinearPredictor, run, run, setIntercept, setValidateData, validateData
public SVMWithSGD()
public static SVMModel train(RDD<LabeledPoint> input, int numIterations, double stepSize, double regParam, double miniBatchFraction, Vector initialWeights)
miniBatchFraction
fraction of the data to calculate the gradient. The weights used in
gradient descent are initialized using the initial weights provided.
NOTE: Labels used in SVM should be {0, 1}.
input
- RDD of (label, array of features) pairs.numIterations
- Number of iterations of gradient descent to run.stepSize
- Step size to be used for each iteration of gradient descent.regParam
- Regularization parameter.miniBatchFraction
- Fraction of data to be used per iteration.initialWeights
- Initial set of weights to be used. Array should be equal in size to
the number of features in the data.public static SVMModel train(RDD<LabeledPoint> input, int numIterations, double stepSize, double regParam, double miniBatchFraction)
miniBatchFraction
fraction of the data to calculate the gradient.
NOTE: Labels used in SVM should be {0, 1}
input
- RDD of (label, array of features) pairs.numIterations
- Number of iterations of gradient descent to run.stepSize
- Step size to be used for each iteration of gradient descent.regParam
- Regularization parameter.miniBatchFraction
- Fraction of data to be used per iteration.public static SVMModel train(RDD<LabeledPoint> input, int numIterations, double stepSize, double regParam)
input
- RDD of (label, array of features) pairs.stepSize
- Step size to be used for each iteration of Gradient Descent.regParam
- Regularization parameter.numIterations
- Number of iterations of gradient descent to run.public static SVMModel train(RDD<LabeledPoint> input, int numIterations)
input
- RDD of (label, array of features) pairs.numIterations
- Number of iterations of gradient descent to run.protected static java.lang.String logName()
protected static org.slf4j.Logger log()
protected static void logInfo(scala.Function0<java.lang.String> msg)
protected static void logDebug(scala.Function0<java.lang.String> msg)
protected static void logTrace(scala.Function0<java.lang.String> msg)
protected static void logWarning(scala.Function0<java.lang.String> msg)
protected static void logError(scala.Function0<java.lang.String> msg)
protected static void logInfo(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logDebug(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logTrace(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logWarning(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logError(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static boolean isTraceEnabled()
protected static void initializeLogIfNecessary(boolean isInterpreter)
protected static boolean addIntercept()
protected static void addIntercept_$eq(boolean x$1)
protected static boolean validateData()
protected static void validateData_$eq(boolean x$1)
protected static int numOfLinearPredictor()
protected static void numOfLinearPredictor_$eq(int x$1)
public static int getNumFeatures()
protected static int numFeatures()
protected static void numFeatures_$eq(int x$1)
public static boolean isAddIntercept()
public static GeneralizedLinearAlgorithm<M> setIntercept(boolean addIntercept)
public static GeneralizedLinearAlgorithm<M> setValidateData(boolean validateData)
protected static Vector generateInitialWeights(RDD<LabeledPoint> input)
public static M run(RDD<LabeledPoint> input)
public static M run(RDD<LabeledPoint> input, Vector initialWeights)
public GradientDescent optimizer()
GeneralizedLinearAlgorithm
optimizer
in class GeneralizedLinearAlgorithm<SVMModel>
protected scala.collection.immutable.List<scala.Function1<RDD<LabeledPoint>,java.lang.Object>> validators()
validators
in class GeneralizedLinearAlgorithm<SVMModel>
protected SVMModel createModel(Vector weights, double intercept)
GeneralizedLinearAlgorithm
createModel
in class GeneralizedLinearAlgorithm<SVMModel>
weights
- (undocumented)intercept
- (undocumented)