module Khiva::Features

Public Class Methods

abs_energy(arr) click to toggle source
# File lib/khiva/features.rb, line 4
def abs_energy(arr)
  result = Utils.create_ptr
  FFI.call(:abs_energy, arr, result)
  Array.new(result)
end
absolute_sum_of_changes(arr) click to toggle source
# File lib/khiva/features.rb, line 10
def absolute_sum_of_changes(arr)
  result = Utils.create_ptr
  FFI.call(:absolute_sum_of_changes, arr, result)
  Array.new(result)
end
aggregated_autocorrelation(arr, aggregation_function) click to toggle source
# File lib/khiva/features.rb, line 16
def aggregated_autocorrelation(arr, aggregation_function)
  result = Utils.create_ptr
  FFI.call(:aggregated_autocorrelation, arr, Utils.int_ptr(aggregation_function), result)
  Array.new(result)
end
approximate_entropy(arr, m, r) click to toggle source

TODO aggregated_linear_trend

# File lib/khiva/features.rb, line 24
def approximate_entropy(arr, m, r)
  result = Utils.create_ptr
  FFI.call(:approximate_entropy, arr, Utils.int_ptr(m), Utils.float_ptr(r), result)
  Array.new(result)
end
auto_correlation(arr, max_lag, unbiased) click to toggle source
# File lib/khiva/features.rb, line 30
def auto_correlation(arr, max_lag, unbiased)
  result = Utils.create_ptr
  FFI.call(:auto_correlation, arr, Utils.long_ptr(max_lag), Utils.bool_ptr(unbiased), result)
  Array.new(result)
end
auto_covariance(arr, unbiased: false) click to toggle source
# File lib/khiva/features.rb, line 36
def auto_covariance(arr, unbiased: false)
  result = Utils.create_ptr
  FFI.call(:auto_covariance, arr, Utils.bool_ptr(unbiased), result)
  Array.new(result)
end
binned_entropy(arr, max_bins) click to toggle source
# File lib/khiva/features.rb, line 42
def binned_entropy(arr, max_bins)
  result = Utils.create_ptr
  FFI.call(:binned_entropy, arr, Utils.int_ptr(max_bins), result)
  Array.new(result)
end
c3(arr, lag) click to toggle source
# File lib/khiva/features.rb, line 48
def c3(arr, lag)
  result = Utils.create_ptr
  FFI.call(:c3, arr, Utils.long_ptr(lag), result)
  Array.new(result)
end
cid_ce(arr, z_normalize) click to toggle source
# File lib/khiva/features.rb, line 54
def cid_ce(arr, z_normalize)
  result = Utils.create_ptr
  FFI.call(:cid_ce, arr, Utils.bool_ptr(z_normalize), result)
  Array.new(result)
end
count_above_mean(arr) click to toggle source
# File lib/khiva/features.rb, line 60
def count_above_mean(arr)
  result = Utils.create_ptr
  FFI.call(:count_above_mean, arr, result)
  Array.new(result)
end
count_below_mean(arr) click to toggle source
# File lib/khiva/features.rb, line 66
def count_below_mean(arr)
  result = Utils.create_ptr
  FFI.call(:count_below_mean, arr, result)
  Array.new(result)
end
cross_correlation(xss, yss, unbiased) click to toggle source
# File lib/khiva/features.rb, line 72
def cross_correlation(xss, yss, unbiased)
  result = Utils.create_ptr
  FFI.call(:cross_correlation, xss, yss, Utils.bool_ptr(unbiased), result)
  Array.new(result)
end
cross_covariance(xss, yss, unbiased) click to toggle source
# File lib/khiva/features.rb, line 78
def cross_covariance(xss, yss, unbiased)
  result = Utils.create_ptr
  FFI.call(:cross_covariance, xss, yss, Utils.bool_ptr(unbiased), result)
  Array.new(result)
end
energy_ratio_by_chunks(arr, num_segments, segment_focus) click to toggle source

TODO cwt_coefficients

# File lib/khiva/features.rb, line 86
def energy_ratio_by_chunks(arr, num_segments, segment_focus)
  result = Utils.create_ptr
  FFI.call(:energy_ratio_by_chunks, arr, Utils.long_ptr(num_segments), Utils.long_ptr(segment_focus), result)
  Array.new(result)
end
fft_aggregated(arr) click to toggle source
# File lib/khiva/features.rb, line 92
def fft_aggregated(arr)
  result = Utils.create_ptr
  FFI.call(:fft_aggregated, arr, result)
  Array.new(result)
end
first_location_of_maximum(arr) click to toggle source

TODO fft_coefficient

# File lib/khiva/features.rb, line 100
def first_location_of_maximum(arr)
  result = Utils.create_ptr
  FFI.call(:first_location_of_maximum, arr, result)
  Array.new(result)
end
first_location_of_minimum(arr) click to toggle source
# File lib/khiva/features.rb, line 106
def first_location_of_minimum(arr)
  result = Utils.create_ptr
  FFI.call(:first_location_of_minimum, arr, result)
  Array.new(result)
end
has_duplicate_max(arr) click to toggle source
# File lib/khiva/features.rb, line 112
def has_duplicate_max(arr)
  result = Utils.create_ptr
  FFI.call(:has_duplicate_max, arr, result)
  Array.new(result)
end
has_duplicate_min(arr) click to toggle source
# File lib/khiva/features.rb, line 118
def has_duplicate_min(arr)
  result = Utils.create_ptr
  FFI.call(:has_duplicate_min, arr, result)
  Array.new(result)
end
has_duplicates(arr) click to toggle source
# File lib/khiva/features.rb, line 124
def has_duplicates(arr)
  result = Utils.create_ptr
  FFI.call(:has_duplicates, arr, result)
  Array.new(result)
end
index_mass_quantile(arr, q) click to toggle source
# File lib/khiva/features.rb, line 130
def index_mass_quantile(arr, q)
  result = Utils.create_ptr
  FFI.call(:index_mass_quantile, arr, Utils.float_ptr(q), result)
  Array.new(result)
end
kurtosis(arr) click to toggle source
# File lib/khiva/features.rb, line 136
def kurtosis(arr)
  result = Utils.create_ptr
  FFI.call(:kurtosis, arr, result)
  Array.new(result)
end
large_standard_deviation(arr, r) click to toggle source
# File lib/khiva/features.rb, line 142
def large_standard_deviation(arr, r)
  result = Utils.create_ptr
  FFI.call(:large_standard_deviation, arr, Utils.float_ptr(r), result)
  Array.new(result)
end
last_location_of_maximum(arr) click to toggle source
# File lib/khiva/features.rb, line 148
def last_location_of_maximum(arr)
  result = Utils.create_ptr
  FFI.call(:last_location_of_maximum, arr, result)
  Array.new(result)
end
last_location_of_minimum(arr) click to toggle source
# File lib/khiva/features.rb, line 154
def last_location_of_minimum(arr)
  result = Utils.create_ptr
  FFI.call(:last_location_of_minimum, arr, result)
  Array.new(result)
end
length(arr) click to toggle source
# File lib/khiva/features.rb, line 160
def length(arr)
  result = Utils.create_ptr
  FFI.call(:length, arr, result)
  Array.new(result)
end
local_maximals(arr) click to toggle source
# File lib/khiva/features.rb, line 166
def local_maximals(arr)
  result = Utils.create_ptr
  FFI.call(:local_maximals, arr, result)
  Array.new(result)
end
longest_strike_above_mean(arr) click to toggle source
# File lib/khiva/features.rb, line 172
def longest_strike_above_mean(arr)
  result = Utils.create_ptr
  FFI.call(:longest_strike_above_mean, arr, result)
  Array.new(result)
end
longest_strike_below_mean(arr) click to toggle source
# File lib/khiva/features.rb, line 178
def longest_strike_below_mean(arr)
  result = Utils.create_ptr
  FFI.call(:longest_strike_below_mean, arr, result)
  Array.new(result)
end
maximum(arr) click to toggle source
# File lib/khiva/features.rb, line 184
def maximum(arr)
  result = Utils.create_ptr
  FFI.call(:maximum, arr, result)
  Array.new(result)
end
mean(arr) click to toggle source
# File lib/khiva/features.rb, line 190
def mean(arr)
  result = Utils.create_ptr
  FFI.call(:mean, arr, result)
  Array.new(result)
end
mean_absolute_change(arr) click to toggle source
# File lib/khiva/features.rb, line 196
def mean_absolute_change(arr)
  result = Utils.create_ptr
  FFI.call(:mean_absolute_change, arr, result)
  Array.new(result)
end
mean_change(arr) click to toggle source
# File lib/khiva/features.rb, line 202
def mean_change(arr)
  result = Utils.create_ptr
  FFI.call(:mean_change, arr, result)
  Array.new(result)
end
mean_second_derivative_central(arr) click to toggle source
# File lib/khiva/features.rb, line 208
def mean_second_derivative_central(arr)
  result = Utils.create_ptr
  FFI.call(:mean_second_derivative_central, arr, result)
  Array.new(result)
end
median(arr) click to toggle source
# File lib/khiva/features.rb, line 214
def median(arr)
  result = Utils.create_ptr
  FFI.call(:median, arr, result)
  Array.new(result)
end
minimum(arr) click to toggle source
# File lib/khiva/features.rb, line 220
def minimum(arr)
  result = Utils.create_ptr
  FFI.call(:minimum, arr, result)
  Array.new(result)
end
number_crossing_m(arr, m) click to toggle source
# File lib/khiva/features.rb, line 226
def number_crossing_m(arr, m)
  result = Utils.create_ptr
  FFI.call(:number_crossing_m, arr, Utils.int_ptr(m), result)
  Array.new(result)
end
number_peaks(arr, n) click to toggle source

TODO number_cwt_peaks

# File lib/khiva/features.rb, line 234
def number_peaks(arr, n)
  result = Utils.create_ptr
  FFI.call(:number_peaks, arr, Utils.int_ptr(n), result)
  Array.new(result)
end
partial_autocorrelation(arr, lags) click to toggle source
# File lib/khiva/features.rb, line 240
def partial_autocorrelation(arr, lags)
  result = Utils.create_ptr
  FFI.call(:partial_autocorrelation, arr, lags, result)
  Array.new(result)
end
percentage_of_reoccurring_datapoints_to_all_datapoints(arr, sorted) click to toggle source
# File lib/khiva/features.rb, line 246
def percentage_of_reoccurring_datapoints_to_all_datapoints(arr, sorted)
  result = Utils.create_ptr
  FFI.call(:percentage_of_reoccurring_datapoints_to_all_datapoints, arr, Utils.bool_ptr(sorted), result)
  Array.new(result)
end
percentage_of_reoccurring_values_to_all_values(arr, sorted) click to toggle source
# File lib/khiva/features.rb, line 252
def percentage_of_reoccurring_values_to_all_values(arr, sorted)
  result = Utils.create_ptr
  FFI.call(:percentage_of_reoccurring_values_to_all_values, arr, Utils.bool_ptr(sorted), result)
  Array.new(result)
end
quantile(arr, q, precision: 100000000) click to toggle source
# File lib/khiva/features.rb, line 258
def quantile(arr, q, precision: 100000000)
  result = Utils.create_ptr
  FFI.call(:quantile, arr, q, Utils.float_ptr(precision), result)
  Array.new(result)
end
range_count(arr, min, max) click to toggle source
# File lib/khiva/features.rb, line 264
def range_count(arr, min, max)
  result = Utils.create_ptr
  FFI.call(:range_count, arr, Utils.float_ptr(min), Utils.float_ptr(max), result)
  Array.new(result)
end
ratio_beyond_r_sigma(arr, r) click to toggle source
# File lib/khiva/features.rb, line 270
def ratio_beyond_r_sigma(arr, r)
  result = Utils.create_ptr
  FFI.call(:ratio_beyond_r_sigma, arr, Utils.float_ptr(r), result)
  Array.new(result)
end
ratio_value_number_to_time_series_length(arr) click to toggle source
# File lib/khiva/features.rb, line 276
def ratio_value_number_to_time_series_length(arr)
  result = Utils.create_ptr
  FFI.call(:ratio_value_number_to_time_series_length, arr, result)
  Array.new(result)
end
sample_entropy(arr) click to toggle source
# File lib/khiva/features.rb, line 282
def sample_entropy(arr)
  result = Utils.create_ptr
  FFI.call(:sample_entropy, arr, result)
  Array.new(result)
end
skewness(arr) click to toggle source
# File lib/khiva/features.rb, line 288
def skewness(arr)
  result = Utils.create_ptr
  FFI.call(:skewness, arr, result)
  Array.new(result)
end
spkt_welch_density(arr, coeff) click to toggle source
# File lib/khiva/features.rb, line 294
def spkt_welch_density(arr, coeff)
  result = Utils.create_ptr
  FFI.call(:spkt_welch_density, arr, Utils.int_ptr(coeff), result)
  Array.new(result)
end
standard_deviation(arr) click to toggle source
# File lib/khiva/features.rb, line 300
def standard_deviation(arr)
  result = Utils.create_ptr
  FFI.call(:standard_deviation, arr, result)
  Array.new(result)
end
sum_of_reoccurring_datapoints(arr, sorted: false) click to toggle source
# File lib/khiva/features.rb, line 306
def sum_of_reoccurring_datapoints(arr, sorted: false)
  result = Utils.create_ptr
  FFI.call(:sum_of_reoccurring_datapoints, arr, Utils.bool_ptr(sorted), result)
  Array.new(result)
end
sum_of_reoccurring_values(arr, sorted: false) click to toggle source
# File lib/khiva/features.rb, line 312
def sum_of_reoccurring_values(arr, sorted: false)
  result = Utils.create_ptr
  FFI.call(:sum_of_reoccurring_values, arr, Utils.bool_ptr(sorted), result)
  Array.new(result)
end
sum_values(arr) click to toggle source
# File lib/khiva/features.rb, line 318
def sum_values(arr)
  result = Utils.create_ptr
  FFI.call(:sum_values, arr, result)
  Array.new(result)
end
symmetry_looking(arr, r) click to toggle source
# File lib/khiva/features.rb, line 324
def symmetry_looking(arr, r)
  result = Utils.create_ptr
  FFI.call(:symmetry_looking, arr, Utils.float_ptr(r), result)
  Array.new(result)
end
time_reversal_asymmetry_statistic(arr, lag) click to toggle source
# File lib/khiva/features.rb, line 330
def time_reversal_asymmetry_statistic(arr, lag)
  result = Utils.create_ptr
  FFI.call(:time_reversal_asymmetry_statistic, arr, Utils.int_ptr(lag), result)
  Array.new(result)
end
value_count(arr, v) click to toggle source
# File lib/khiva/features.rb, line 336
def value_count(arr, v)
  result = Utils.create_ptr
  FFI.call(:value_count, arr, Utils.float_ptr(v), result)
  Array.new(result)
end
variance(arr) click to toggle source
# File lib/khiva/features.rb, line 342
def variance(arr)
  result = Utils.create_ptr
  FFI.call(:variance, arr, result)
  Array.new(result)
end
variance_larger_than_standard_deviation(arr) click to toggle source
# File lib/khiva/features.rb, line 348
def variance_larger_than_standard_deviation(arr)
  result = Utils.create_ptr
  FFI.call(:variance_larger_than_standard_deviation, arr, result)
  Array.new(result)
end