class ML::Learner::AdaptivePerceptronLearner
Implementation of Adaptive Perceptron Learning Algorithm
Public Class Methods
new(dim, eta = 0.1)
click to toggle source
Initialize an adaptive perceptron learner
@param [Integer] dim the number of dimension @param [Float] the eta parameter
Calls superclass method
# File lib/method/adaptive_perceptron.rb, line 11 def initialize dim, eta = 0.1 super(dim) @eta = eta end
Protected Instance Methods
update_vector(x, y)
click to toggle source
# File lib/method/adaptive_perceptron.rb, line 21 def update_vector x, y self.current_vector += @eta * (y - classify_inner(x))* x end
wrongly_classify(x, y)
click to toggle source
# File lib/method/adaptive_perceptron.rb, line 17 def wrongly_classify x, y classify_inner(x) * y <= 1 end