Module: LearnKit::Knn::Predict
- Included in:
- LearnKit::Knn
- Defined in:
- lib/learn_kit/knn/predict.rb
Overview
Fit test data
Constant Summary collapse
- UNIFORM_WEIGHT =
1
Instance Method Summary collapse
-
#predict(args = {}) ⇒ Object
input data { k: 3, algorithm: ‘brute’, weight: ‘uniform’, point: [1, 2, 3] } algorithms: brute weights: uniform, distance.
Instance Method Details
#predict(args = {}) ⇒ Object
input data { k: 3, algorithm: ‘brute’, weight: ‘uniform’, point: [1, 2, 3] } algorithms: brute weights: uniform, distance
11 12 13 14 15 16 |
# File 'lib/learn_kit/knn/predict.rb', line 11 def predict(args = {}) calc_distances(args) if points.size.zero? prediction(sort_points(args)) rescue LearnFailure => ex puts "LearnFailure: #{ex.}" end |