Method: ML::Data::Generator2D#points_2d
- Defined in:
- lib/data/generator.rb
#points_2d(points, coef = [-1.0, 1.0, 0.0]) ⇒ Hash
Generate two groups of points on 2d plain
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/data/generator.rb', line 30 def points_2d points, coef = [-1.0, 1.0, 0.0] result = {} # for each group [1, -1].each do |grp| points.times do while true point = generate_point prod = Matrix.column_vector(point).transpose * Matrix.column_vector(coef) if (prod[0,0] <=> 0) == grp result[point] = grp break end end end end result end |