khiva 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bf2169ce0f0464a8c9d6e07e962a3d00cc8cf1403178f562b2dc6b694915460
4
- data.tar.gz: eb67390404557a984c16a7bcdf72cf3b943cf9b85e4f57b9ed2ae22fd55a1eab
3
+ metadata.gz: bb48358c9961cf78042430533542244a794c1332b9df562314901063bfe9df43
4
+ data.tar.gz: 8fbbd152a6c84cd4bd4ff1a62519cdb1de19d25d48cfb9203024ac1e5a5d838b
5
5
  SHA512:
6
- metadata.gz: 60d803c2a01cfcc47fb05e5663fc5c884b77ba20b73aaed88bc8042912546c846d57265800409eb41fccfc2d5a5720e81c4a5f3f13c987ca73ac429d801d6ce7
7
- data.tar.gz: c5e223048d0736927ec5b1440f7b3d993bc71a411f0e08f6a0ee26d1407a275e3a7da2e6e22b5515deb5f45e701ce899334fd72b6ea8e7e8963a983a9db0b545
6
+ metadata.gz: 9cfed0a65e0ff7b915df05ed240f2440a580c03b045967cdce139c985d0679e0f2c24c71108941e877083fd10511da4ce35c16c3942baf2bddbb47621d744c13
7
+ data.tar.gz: ac8cbafe3011b28e25e16edc24c6fb459a4881a564dba62392aca7f6925efce7211dfb75fb5b2eed9a02071c26e16357635a21bc137d01eaa8019c19e6c0fd21
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.3 (2021-02-18)
2
+
3
+ - Added `chains` method
4
+
1
5
  ## 0.1.2 (2020-12-19)
2
6
 
3
7
  - Added `find_best_n_occurrences` and `mass` methods
data/README.md CHANGED
@@ -98,9 +98,14 @@ plt.legend
98
98
  Find a similar pattern in time series
99
99
 
100
100
  ```ruby
101
- series = Khiva::Array.new([1, 2, 3, 4, 3, 4, 5, 6], type: :f32)
102
- query = Khiva::Array.new([1, 2, 1], type: :f32)
103
- distances, indices = Khiva::Matrix.find_best_n_occurrences(query, series, 1)
101
+ series = [1, 1, 1, 3, 4, 1, 1, 1, 1]
102
+ query = [1, 2, 3]
103
+
104
+ s = Khiva::Array.new(series, type: :f32)
105
+ q = Khiva::Array.new(query, type: :f32)
106
+ _, indices = Khiva::Matrix.find_best_n_occurrences(q, s, 1)
107
+ pos = indices.to_a.first
108
+ similar_subsequence = series[pos, query.size] # [1, 3, 4]
104
109
  ```
105
110
 
106
111
  ## Modules
@@ -714,6 +719,12 @@ Calculate the matrix profile between `t` and itself using a subsequence length o
714
719
  profile, index = Khiva::Matrix.matrix_profile_self_join(t, m)
715
720
  ```
716
721
 
722
+ Get chains
723
+
724
+ ```ruby
725
+ Khiva::Matrix.chains(tss, m)
726
+ ```
727
+
717
728
  ## Normalization
718
729
 
719
730
  Decimal scaling
@@ -818,35 +829,28 @@ Khiva::Statistics.skewness(tss)
818
829
 
819
830
  ## Khiva Installation
820
831
 
821
- ### Linux
832
+ ### Linux - Ubuntu
822
833
 
823
- Install Boost and Eigen. On Ubuntu, use:
834
+ Install ArrayFire:
824
835
 
825
836
  ```sh
826
- sudo apt-get install libboost-all-dev libeigen3-dev
837
+ sudo apt-key adv --fetch-key https://repo.arrayfire.com/GPG-PUB-KEY-ARRAYFIRE-2020.PUB
838
+ echo "deb [arch=amd64] https://repo.arrayfire.com/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) main" | sudo tee /etc/apt/sources.list.d/arrayfire.list
839
+ sudo apt-get update
840
+ sudo apt-get install arrayfire-unified3 arrayfire-cpu3-openblas arrayfire-opencl3-openblas
827
841
  ```
828
842
 
829
- Install ArrayFire:
843
+ And install Khiva:
830
844
 
831
845
  ```sh
832
- wget -q https://arrayfire.s3.amazonaws.com/3.7.3/ArrayFire-v3.7.3_Linux_x86_64.sh
833
- chmod +x ./ArrayFire-v3.7.3_Linux_x86_64.sh
834
- ./ArrayFire-v3.7.3_Linux_x86_64.sh --include-subdir --prefix=/opt
835
- echo /opt/arrayfire/lib64 | sudo tee /etc/ld.so.conf.d/arrayfire.conf
846
+ wget https://github.com/shapelets/khiva/releases/download/v0.5.0/khiva-khiva_0.5.0_amd64.deb
847
+ sudo dpkg -i khiva-khiva_0.5.0_amd64.deb
836
848
  sudo ldconfig
837
849
  ```
838
850
 
839
- And install Khiva:
851
+ ### Linux - Other
840
852
 
841
- ```sh
842
- git clone --recursive --branch v0.5.0 https://github.com/shapelets/khiva
843
- cd khiva
844
- mkdir build
845
- cd build
846
- cmake .. -DKHIVA_USE_CONAN=OFF -DKHIVA_BUILD_TESTS=OFF -DKHIVA_BUILD_BENCHMARKS=OFF -DKHIVA_BUILD_JNI_BINDINGS=OFF
847
- make -j4
848
- sudo make install
849
- ```
853
+ See [instructions](https://khiva.readthedocs.io/en/latest/gettingStarted.html).
850
854
 
851
855
  ### Mac
852
856
 
@@ -858,7 +862,7 @@ brew install khiva
858
862
 
859
863
  ### Windows
860
864
 
861
- See [instructions](https://khiva.readthedocs.io/en/latest/gettingStarted.html#windows).
865
+ See [instructions](https://khiva.readthedocs.io/en/latest/gettingStarted.html).
862
866
 
863
867
  ## Credits
864
868
 
data/lib/khiva/matrix.rb CHANGED
@@ -57,6 +57,12 @@ module Khiva
57
57
  FFI.call(:matrix_profile_self_join, tss, m, profile, index)
58
58
  [Array.new(profile), Array.new(index)]
59
59
  end
60
+
61
+ def chains(tss, m)
62
+ chains = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
63
+ FFI.call(:get_chains, tss, m, chains)
64
+ Array.new(chains)
65
+ end
60
66
  end
61
67
  end
62
68
  end
data/lib/khiva/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Khiva
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: khiva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-20 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
- email: andrew@chartkick.com
14
+ email: andrew@ankane.org
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  requirements: []
58
- rubygems_version: 3.1.4
58
+ rubygems_version: 3.2.3
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: High-performance time series algorithms for Ruby