module ML::Learner::Toolbox
General toolbox for learning methods
Public Instance Methods
classify_error(supervised_data)
click to toggle source
Calculating model error
@param [Hash] data
supervised input data (mapping from array to integer)
# File lib/method/toolbox.rb, line 20 def classify_error supervised_data error = 0 for data, result in supervised_data classified_result = predict(data) error += 1 unless result == classified_result end error.to_f / supervised_data.size end
predict(data)
click to toggle source
Predict a single data with current prediction
@param [Array] data input vector array @return [Integer] classified data
# File lib/method/toolbox.rb, line 12 def predict data raise "Cannot predict" end