class Spark::Mllib::RegressionMethodBase
Parent for regression methods
Public Class Methods
train(rdd, options)
click to toggle source
# File lib/spark/mllib/regression/common.rb, line 48 def self.train(rdd, options) # String keys to symbols options.symbolize_keys! # Reverse merge self::DEFAULT_OPTIONS.each do |key, value| if options.has_key?(key) # value from user else options[key] = value end end # Validation first = rdd.first unless first.is_a?(LabeledPoint) raise Spark::MllibError, "RDD should contains LabeledPoint, got #{first.class}" end # Initial weights is optional for user (not for Spark) options[:initial_weights] = Vectors.to_vector(options[:initial_weights] || [0.0] * first.features.size) end