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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +26 -22
- data/lib/khiva/matrix.rb +6 -0
- data/lib/khiva/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb48358c9961cf78042430533542244a794c1332b9df562314901063bfe9df43
|
4
|
+
data.tar.gz: 8fbbd152a6c84cd4bd4ff1a62519cdb1de19d25d48cfb9203024ac1e5a5d838b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cfed0a65e0ff7b915df05ed240f2440a580c03b045967cdce139c985d0679e0f2c24c71108941e877083fd10511da4ce35c16c3942baf2bddbb47621d744c13
|
7
|
+
data.tar.gz: ac8cbafe3011b28e25e16edc24c6fb459a4881a564dba62392aca7f6925efce7211dfb75fb5b2eed9a02071c26e16357635a21bc137d01eaa8019c19e6c0fd21
|
data/CHANGELOG.md
CHANGED
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 =
|
102
|
-
query =
|
103
|
-
|
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
|
834
|
+
Install ArrayFire:
|
824
835
|
|
825
836
|
```sh
|
826
|
-
sudo apt-
|
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
|
-
|
843
|
+
And install Khiva:
|
830
844
|
|
831
845
|
```sh
|
832
|
-
wget
|
833
|
-
|
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
|
-
|
851
|
+
### Linux - Other
|
840
852
|
|
841
|
-
|
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
|
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
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.
|
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:
|
11
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
|
-
email: andrew@
|
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.
|
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
|