Module: Khiva::Clustering

Defined in:
lib/khiva/clustering.rb

Class Method Summary collapse

Class Method Details

.k_means(tss, k, tolerance: 1e-10, max_iterations: 100) ⇒ Object



4
5
6
7
8
9
# File 'lib/khiva/clustering.rb', line 4

def k_means(tss, k, tolerance: 1e-10, max_iterations: 100)
  centroids = Utils.create_ptr
  labels = Utils.create_ptr
  FFI.call(:k_means, tss, Utils.int_ptr(k), centroids, labels, Utils.float_ptr(tolerance), Utils.int_ptr(max_iterations))
  [Array.new(centroids), Array.new(labels)]
end

.k_shape(tss, k, tolerance: 1e-10, max_iterations: 100) ⇒ Object



11
12
13
14
15
16
# File 'lib/khiva/clustering.rb', line 11

def k_shape(tss, k, tolerance: 1e-10, max_iterations: 100)
  centroids = Utils.create_ptr
  labels = Utils.create_ptr
  FFI.call(:k_shape, tss, Utils.int_ptr(k), centroids, labels, Utils.float_ptr(tolerance), Utils.int_ptr(max_iterations))
  [Array.new(centroids), Array.new(labels)]
end