module Khiva::Clustering

Public Class Methods

k_means(tss, k, tolerance: 1e-10, max_iterations: 100) click to toggle source
# 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) click to toggle source
# 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