lib/svmkit/linear_model/pegasos_svc.rb in svmkit-0.1.2 vs lib/svmkit/linear_model/pegasos_svc.rb in svmkit-0.1.3
- old
+ new
@@ -42,15 +42,16 @@
# Create a new classifier with Support Vector Machine by the Pegasos algorithm.
#
# @overload new(reg_param: 1.0, max_iter: 100, batch_size: 50, random_seed: 1) -> PegasosSVC
#
- # @param reg_param [Float] (defaults to: 1.0) The regularization parameter.
- # @param fit_bias [Boolean] (defaults to: false) The flag indicating whether to fit the bias term.
- # @param bias_scale [Float] (defaults to: 1.0) The scale of the bias term.
- # @param max_iter [Integer] (defaults to: 100) The maximum number of iterations.
- # @param batch_size [Integer] (defaults to: 50) The size of the mini batches.
- # @param random_seed [Integer] (defaults to: nil) The seed value using to initialize the random generator.
+ # @param params [Hash] The parameters for SVC.
+ # @option params [Float] :reg_param (1.0) The regularization parameter.
+ # @option params [Boolean] :fit_bias (false) The flag indicating whether to fit the bias term.
+ # @option params [Float] :bias_scale (1.0) The scale of the bias term.
+ # @option params [Integer] :max_iter (100) The maximum number of iterations.
+ # @option params [Integer] :batch_size (50) The size of the mini batches.
+ # @option params [Integer] :random_seed (nil) The seed value using to initialize the random generator.
def initialize(params = {})
self.params = DEFAULT_PARAMS.merge(Hash[params.map { |k, v| [k.to_sym, v] }])
self.params[:random_seed] ||= srand
@weight_vec = nil
@bias_term = 0.0