class Spark::Mllib::SVMWithSGD
Constants
- DEFAULT_OPTIONS
Public Class Methods
train(rdd, options={})
click to toggle source
Train a support vector machine on the given data.
- rdd
-
The training data, an
RDD
ofLabeledPoint
. - iterations
-
The number of iterations (default: 100).
- step
-
The step parameter used in SGD (default: 1.0).
- reg_param
-
The regularizer parameter (default: 0.01).
- mini_batch_fraction
-
Fraction of data to be used for each SGD iteration.
- initial_weights
-
The initial weights (default: nil).
- reg_type
-
The type of regularizer used for training our model (default: “l2”).
Allowed values:
-
“l1” for using L1 regularization
-
“l2” for using L2 regularization
-
nil for no regularization
-
- intercept
-
Boolean parameter which indicates the use or not of the augmented representation for training data (i.e. whether bias features are activated or not). (default: false)
- validateData
-
Boolean parameter which indicates if the algorithm should validate data before training. (default: true)
Calls superclass method
# File lib/spark/mllib/classification/svm.rb, line 125 def self.train(rdd, options={}) super weights, intercept = Spark.jb.call(RubyMLLibAPI.new, 'trainSVMModelWithSGD', rdd, options[:iterations].to_i, options[:step].to_f, options[:reg_param].to_f, options[:mini_batch_fraction].to_f, options[:initial_weights], options[:reg_type], options[:intercept], options[:validate]) SVMModel.new(weights, intercept) end