Class: LearnKit::Knn
- Inherits:
-
Object
- Object
- LearnKit::Knn
- Includes:
- Predict
- Defined in:
- lib/learn_kit/knn.rb,
lib/learn_kit/knn/predict.rb
Overview
K-Nearest Neighbors algorithm
Defined Under Namespace
Modules: Predict Classes: LearnFailure
Constant Summary
Constants included from Predict
Instance Attribute Summary collapse
-
#data_set ⇒ Object
readonly
Returns the value of attribute data_set.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Knn
constructor
input data { label1: [[f1, f2, f3], [f1, f2, f3]], label2: [[f4, f5, f6], [f4, f5, f6]] }.
Methods included from Predict
Constructor Details
#initialize(args = {}) ⇒ Knn
input data { label1: [[f1, f2, f3], [f1, f2, f3]], label2: [[f4, f5, f6], [f4, f5, f6]] }
14 15 16 17 |
# File 'lib/learn_kit/knn.rb', line 14 def initialize(args = {}) @data_set = args[:data_set] @points = [] end |
Instance Attribute Details
#data_set ⇒ Object (readonly)
Returns the value of attribute data_set.
10 11 12 |
# File 'lib/learn_kit/knn.rb', line 10 def data_set @data_set end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
10 11 12 |
# File 'lib/learn_kit/knn.rb', line 10 def points @points end |