rcf 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/NOTICE.txt +2 -0
- data/README.md +19 -0
- data/lib/rcf/ffi.rb +1 -0
- data/lib/rcf/forest.rb +14 -2
- data/lib/rcf/version.rb +1 -1
- data/vendor/aarch64-linux/{THIRD-PARTY-LICENSES → LICENSE-THIRD-PARTY} +0 -0
- data/vendor/aarch64-linux/NOTICE +2 -0
- data/vendor/aarch64-linux/README.md +34 -3
- data/vendor/aarch64-linux/lib/librcf.so +0 -0
- data/vendor/arm64-darwin/{THIRD-PARTY-LICENSES → LICENSE-THIRD-PARTY} +0 -0
- data/vendor/arm64-darwin/NOTICE +2 -0
- data/vendor/arm64-darwin/README.md +34 -3
- data/vendor/arm64-darwin/lib/librcf.dylib +0 -0
- data/vendor/{x86_64-darwin/THIRD-PARTY-LICENSES → x64-mingw/LICENSE-THIRD-PARTY} +0 -0
- data/vendor/x64-mingw/NOTICE +2 -0
- data/vendor/x64-mingw/README.md +34 -3
- data/vendor/x64-mingw/lib/rcf.dll +0 -0
- data/vendor/{x86_64-linux/THIRD-PARTY-LICENSES → x86_64-darwin/LICENSE-THIRD-PARTY} +0 -0
- data/vendor/x86_64-darwin/NOTICE +2 -0
- data/vendor/x86_64-darwin/README.md +34 -3
- data/vendor/x86_64-darwin/lib/librcf.dylib +0 -0
- data/vendor/x86_64-linux/LICENSE-THIRD-PARTY +7025 -0
- data/vendor/x86_64-linux/NOTICE +2 -0
- data/vendor/x86_64-linux/README.md +34 -3
- data/vendor/x86_64-linux/lib/librcf.so +0 -0
- metadata +13 -7
- data/vendor/x64-mingw/THIRD-PARTY-LICENSES +0 -7025
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d050fe5e3a88cc6361c5cdb592b558cca82c1c7c35daeb9398db69929d94451d
|
4
|
+
data.tar.gz: 932e1d587efeed620a8f833ab95a2b94a29424430264c11b92cc56e88a86bb3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd55dac9c224b53617af4a91d56c4bcfdd0b1317b03bee93c35fba20798d3d94a1af874ae9a103b32cd53f5418c89c4a7489ae3bd3c8cfce0267a8beb3b9837b
|
7
|
+
data.tar.gz: 3ab0d7a74cf233855b28dcb751c11e77b78efbd88afcfb19e1cfd6533852f3f354db74e06726883bb9dcd3af27b744a6dfe887ace0f60aaca9848ee2d915e7ec
|
data/CHANGELOG.md
CHANGED
data/NOTICE.txt
ADDED
data/README.md
CHANGED
@@ -51,6 +51,25 @@ forest = Rcf::Forest.new(3)
|
|
51
51
|
end
|
52
52
|
```
|
53
53
|
|
54
|
+
## Parameters
|
55
|
+
|
56
|
+
Set parameters [unreleased]
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
Rcf::Forest.new(
|
60
|
+
dimensions,
|
61
|
+
shingle_size: 1, # shingle size to use
|
62
|
+
sample_size: 256, # points to keep in sample for each tree
|
63
|
+
number_of_trees: 100, # number of trees to use in the forest
|
64
|
+
random_seed: 42, # random seed to use
|
65
|
+
parallel: false # enable parallel execution
|
66
|
+
)
|
67
|
+
```
|
68
|
+
|
69
|
+
## References
|
70
|
+
|
71
|
+
- [Robust Random Cut Forest Based Anomaly Detection On Streams](https://proceedings.mlr.press/v48/guha16.pdf)
|
72
|
+
|
54
73
|
## History
|
55
74
|
|
56
75
|
View the [changelog](CHANGELOG.md)
|
data/lib/rcf/ffi.rb
CHANGED
@@ -11,6 +11,7 @@ module Rcf
|
|
11
11
|
end
|
12
12
|
|
13
13
|
extern "rcf_forest *rcf_create(size_t dimensions)"
|
14
|
+
extern "int rcf_set_param(rcf_forest *forest, const char *param, const char *value)"
|
14
15
|
extern "void rcf_update(rcf_forest *rcf, const float *point)"
|
15
16
|
extern "double rcf_score(rcf_forest *rcf, const float *point)"
|
16
17
|
extern "void rcf_free(rcf_forest *rcf)"
|
data/lib/rcf/forest.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
module Rcf
|
2
2
|
class Forest
|
3
|
-
def initialize(dimensions)
|
3
|
+
def initialize(dimensions, shingle_size: 1, sample_size: 256, number_of_trees: 100, random_seed: 42, parallel: false)
|
4
4
|
@dimensions = dimensions
|
5
|
-
@pointer = FFI.rcf_create(dimensions)
|
6
5
|
|
6
|
+
@pointer = FFI.rcf_create(dimensions)
|
7
7
|
ObjectSpace.define_finalizer(self, self.class.finalize(@pointer))
|
8
|
+
|
9
|
+
set_param("shingle_size", shingle_size)
|
10
|
+
set_param("sample_size", sample_size)
|
11
|
+
set_param("number_of_trees", number_of_trees)
|
12
|
+
set_param("random_seed", random_seed)
|
13
|
+
set_param("parallel", parallel)
|
8
14
|
end
|
9
15
|
|
10
16
|
def score(point)
|
@@ -22,6 +28,12 @@ module Rcf
|
|
22
28
|
|
23
29
|
private
|
24
30
|
|
31
|
+
def set_param(param, value)
|
32
|
+
if FFI.rcf_set_param(@pointer, param, value.to_s) != 0
|
33
|
+
raise ArgumentError, "Invalid value for #{param}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
25
37
|
def point_ptr(point)
|
26
38
|
if point.size != @dimensions
|
27
39
|
raise ArgumentError, "Bad size"
|
data/lib/rcf/version.rb
CHANGED
File without changes
|
@@ -2,15 +2,17 @@
|
|
2
2
|
|
3
3
|
[Random Cut Forest](https://github.com/aws/random-cut-forest-by-aws) (RCF) anomaly detection for C/C++
|
4
4
|
|
5
|
+
:evergreen_tree: Also available for [Ruby](https://github.com/ankane/random-cut-forest-ruby) and [PHP](https://github.com/ankane/random-cut-forest-php), and as a [CLI](https://github.com/ankane/rcf-cli)
|
6
|
+
|
5
7
|
[](https://github.com/ankane/librcf/actions)
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Download the latest version:
|
10
12
|
|
11
|
-
- Linux - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
12
|
-
- Mac - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
13
|
-
- Windows - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
13
|
+
- Linux - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-unknown-linux-gnu.tar.gz) or [arm64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-aarch64-unknown-linux-gnu.tar.gz)
|
14
|
+
- Mac - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-apple-darwin.tar.gz) or [arm64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-aarch64-apple-darwin.tar.gz)
|
15
|
+
- Windows - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-pc-windows-msvc.zip)
|
14
16
|
|
15
17
|
You can also install it with Homebrew:
|
16
18
|
|
@@ -32,6 +34,12 @@ Create a forest with 3 dimensions
|
|
32
34
|
rcf_forest *forest = rcf_create(3);
|
33
35
|
```
|
34
36
|
|
37
|
+
Set parameters
|
38
|
+
|
39
|
+
```c
|
40
|
+
rcf_set_param(forest, "number_of_trees", "100");
|
41
|
+
```
|
42
|
+
|
35
43
|
Score a point
|
36
44
|
|
37
45
|
```c
|
@@ -65,6 +73,7 @@ float randf() {
|
|
65
73
|
|
66
74
|
int main() {
|
67
75
|
rcf_forest *forest = rcf_create(3);
|
76
|
+
rcf_set_param(forest, "number_of_trees", "100");
|
68
77
|
|
69
78
|
for (int i = 0; i < 200; i++) {
|
70
79
|
float point[] = {randf(), randf(), randf()};
|
@@ -84,6 +93,28 @@ int main() {
|
|
84
93
|
}
|
85
94
|
```
|
86
95
|
|
96
|
+
## Parameters
|
97
|
+
|
98
|
+
Name | Description | Default Value
|
99
|
+
--- | --- | ---
|
100
|
+
`shingle_size` | Shingle size to use | 1
|
101
|
+
`sample_size` | Points to keep in sample for each tree | 256
|
102
|
+
`number_of_trees` | Number of trees to use in the forest | 100
|
103
|
+
`random_seed` | Random seed to use | 42
|
104
|
+
`parallel` | Enable parallel execution | false
|
105
|
+
|
106
|
+
Parameter values should always be passed as strings.
|
107
|
+
|
108
|
+
```c
|
109
|
+
rcf_set_param(forest, "parallel", "true");
|
110
|
+
```
|
111
|
+
|
112
|
+
`rcf_set_param` returns zero if successful and nonzero if the name or value is invalid or if it’s called after `rcf_score` or `rcf_update`.
|
113
|
+
|
114
|
+
## Reference
|
115
|
+
|
116
|
+
- [Robust Random Cut Forest Based Anomaly Detection On Streams](https://proceedings.mlr.press/v48/guha16.pdf)
|
117
|
+
|
87
118
|
## History
|
88
119
|
|
89
120
|
View the [changelog](CHANGELOG.md)
|
Binary file
|
File without changes
|
@@ -2,15 +2,17 @@
|
|
2
2
|
|
3
3
|
[Random Cut Forest](https://github.com/aws/random-cut-forest-by-aws) (RCF) anomaly detection for C/C++
|
4
4
|
|
5
|
+
:evergreen_tree: Also available for [Ruby](https://github.com/ankane/random-cut-forest-ruby) and [PHP](https://github.com/ankane/random-cut-forest-php), and as a [CLI](https://github.com/ankane/rcf-cli)
|
6
|
+
|
5
7
|
[](https://github.com/ankane/librcf/actions)
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Download the latest version:
|
10
12
|
|
11
|
-
- Linux - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
12
|
-
- Mac - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
13
|
-
- Windows - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
13
|
+
- Linux - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-unknown-linux-gnu.tar.gz) or [arm64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-aarch64-unknown-linux-gnu.tar.gz)
|
14
|
+
- Mac - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-apple-darwin.tar.gz) or [arm64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-aarch64-apple-darwin.tar.gz)
|
15
|
+
- Windows - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-pc-windows-msvc.zip)
|
14
16
|
|
15
17
|
You can also install it with Homebrew:
|
16
18
|
|
@@ -32,6 +34,12 @@ Create a forest with 3 dimensions
|
|
32
34
|
rcf_forest *forest = rcf_create(3);
|
33
35
|
```
|
34
36
|
|
37
|
+
Set parameters
|
38
|
+
|
39
|
+
```c
|
40
|
+
rcf_set_param(forest, "number_of_trees", "100");
|
41
|
+
```
|
42
|
+
|
35
43
|
Score a point
|
36
44
|
|
37
45
|
```c
|
@@ -65,6 +73,7 @@ float randf() {
|
|
65
73
|
|
66
74
|
int main() {
|
67
75
|
rcf_forest *forest = rcf_create(3);
|
76
|
+
rcf_set_param(forest, "number_of_trees", "100");
|
68
77
|
|
69
78
|
for (int i = 0; i < 200; i++) {
|
70
79
|
float point[] = {randf(), randf(), randf()};
|
@@ -84,6 +93,28 @@ int main() {
|
|
84
93
|
}
|
85
94
|
```
|
86
95
|
|
96
|
+
## Parameters
|
97
|
+
|
98
|
+
Name | Description | Default Value
|
99
|
+
--- | --- | ---
|
100
|
+
`shingle_size` | Shingle size to use | 1
|
101
|
+
`sample_size` | Points to keep in sample for each tree | 256
|
102
|
+
`number_of_trees` | Number of trees to use in the forest | 100
|
103
|
+
`random_seed` | Random seed to use | 42
|
104
|
+
`parallel` | Enable parallel execution | false
|
105
|
+
|
106
|
+
Parameter values should always be passed as strings.
|
107
|
+
|
108
|
+
```c
|
109
|
+
rcf_set_param(forest, "parallel", "true");
|
110
|
+
```
|
111
|
+
|
112
|
+
`rcf_set_param` returns zero if successful and nonzero if the name or value is invalid or if it’s called after `rcf_score` or `rcf_update`.
|
113
|
+
|
114
|
+
## Reference
|
115
|
+
|
116
|
+
- [Robust Random Cut Forest Based Anomaly Detection On Streams](https://proceedings.mlr.press/v48/guha16.pdf)
|
117
|
+
|
87
118
|
## History
|
88
119
|
|
89
120
|
View the [changelog](CHANGELOG.md)
|
Binary file
|
File without changes
|
data/vendor/x64-mingw/README.md
CHANGED
@@ -2,15 +2,17 @@
|
|
2
2
|
|
3
3
|
[Random Cut Forest](https://github.com/aws/random-cut-forest-by-aws) (RCF) anomaly detection for C/C++
|
4
4
|
|
5
|
+
:evergreen_tree: Also available for [Ruby](https://github.com/ankane/random-cut-forest-ruby) and [PHP](https://github.com/ankane/random-cut-forest-php), and as a [CLI](https://github.com/ankane/rcf-cli)
|
6
|
+
|
5
7
|
[](https://github.com/ankane/librcf/actions)
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Download the latest version:
|
10
12
|
|
11
|
-
- Linux - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
12
|
-
- Mac - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
13
|
-
- Windows - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
13
|
+
- Linux - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-unknown-linux-gnu.tar.gz) or [arm64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-aarch64-unknown-linux-gnu.tar.gz)
|
14
|
+
- Mac - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-apple-darwin.tar.gz) or [arm64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-aarch64-apple-darwin.tar.gz)
|
15
|
+
- Windows - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-pc-windows-msvc.zip)
|
14
16
|
|
15
17
|
You can also install it with Homebrew:
|
16
18
|
|
@@ -32,6 +34,12 @@ Create a forest with 3 dimensions
|
|
32
34
|
rcf_forest *forest = rcf_create(3);
|
33
35
|
```
|
34
36
|
|
37
|
+
Set parameters
|
38
|
+
|
39
|
+
```c
|
40
|
+
rcf_set_param(forest, "number_of_trees", "100");
|
41
|
+
```
|
42
|
+
|
35
43
|
Score a point
|
36
44
|
|
37
45
|
```c
|
@@ -65,6 +73,7 @@ float randf() {
|
|
65
73
|
|
66
74
|
int main() {
|
67
75
|
rcf_forest *forest = rcf_create(3);
|
76
|
+
rcf_set_param(forest, "number_of_trees", "100");
|
68
77
|
|
69
78
|
for (int i = 0; i < 200; i++) {
|
70
79
|
float point[] = {randf(), randf(), randf()};
|
@@ -84,6 +93,28 @@ int main() {
|
|
84
93
|
}
|
85
94
|
```
|
86
95
|
|
96
|
+
## Parameters
|
97
|
+
|
98
|
+
Name | Description | Default Value
|
99
|
+
--- | --- | ---
|
100
|
+
`shingle_size` | Shingle size to use | 1
|
101
|
+
`sample_size` | Points to keep in sample for each tree | 256
|
102
|
+
`number_of_trees` | Number of trees to use in the forest | 100
|
103
|
+
`random_seed` | Random seed to use | 42
|
104
|
+
`parallel` | Enable parallel execution | false
|
105
|
+
|
106
|
+
Parameter values should always be passed as strings.
|
107
|
+
|
108
|
+
```c
|
109
|
+
rcf_set_param(forest, "parallel", "true");
|
110
|
+
```
|
111
|
+
|
112
|
+
`rcf_set_param` returns zero if successful and nonzero if the name or value is invalid or if it’s called after `rcf_score` or `rcf_update`.
|
113
|
+
|
114
|
+
## References
|
115
|
+
|
116
|
+
- [Robust Random Cut Forest Based Anomaly Detection On Streams](https://proceedings.mlr.press/v48/guha16.pdf)
|
117
|
+
|
87
118
|
## History
|
88
119
|
|
89
120
|
View the [changelog](CHANGELOG.md)
|
Binary file
|
File without changes
|
@@ -2,15 +2,17 @@
|
|
2
2
|
|
3
3
|
[Random Cut Forest](https://github.com/aws/random-cut-forest-by-aws) (RCF) anomaly detection for C/C++
|
4
4
|
|
5
|
+
:evergreen_tree: Also available for [Ruby](https://github.com/ankane/random-cut-forest-ruby) and [PHP](https://github.com/ankane/random-cut-forest-php), and as a [CLI](https://github.com/ankane/rcf-cli)
|
6
|
+
|
5
7
|
[](https://github.com/ankane/librcf/actions)
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Download the latest version:
|
10
12
|
|
11
|
-
- Linux - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
12
|
-
- Mac - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
13
|
-
- Windows - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.
|
13
|
+
- Linux - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-unknown-linux-gnu.tar.gz) or [arm64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-aarch64-unknown-linux-gnu.tar.gz)
|
14
|
+
- Mac - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-apple-darwin.tar.gz) or [arm64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-aarch64-apple-darwin.tar.gz)
|
15
|
+
- Windows - [x86_64](https://github.com/ankane/librcf/releases/download/v0.1.1/librcf-0.1.1-x86_64-pc-windows-msvc.zip)
|
14
16
|
|
15
17
|
You can also install it with Homebrew:
|
16
18
|
|
@@ -32,6 +34,12 @@ Create a forest with 3 dimensions
|
|
32
34
|
rcf_forest *forest = rcf_create(3);
|
33
35
|
```
|
34
36
|
|
37
|
+
Set parameters
|
38
|
+
|
39
|
+
```c
|
40
|
+
rcf_set_param(forest, "number_of_trees", "100");
|
41
|
+
```
|
42
|
+
|
35
43
|
Score a point
|
36
44
|
|
37
45
|
```c
|
@@ -65,6 +73,7 @@ float randf() {
|
|
65
73
|
|
66
74
|
int main() {
|
67
75
|
rcf_forest *forest = rcf_create(3);
|
76
|
+
rcf_set_param(forest, "number_of_trees", "100");
|
68
77
|
|
69
78
|
for (int i = 0; i < 200; i++) {
|
70
79
|
float point[] = {randf(), randf(), randf()};
|
@@ -84,6 +93,28 @@ int main() {
|
|
84
93
|
}
|
85
94
|
```
|
86
95
|
|
96
|
+
## Parameters
|
97
|
+
|
98
|
+
Name | Description | Default Value
|
99
|
+
--- | --- | ---
|
100
|
+
`shingle_size` | Shingle size to use | 1
|
101
|
+
`sample_size` | Points to keep in sample for each tree | 256
|
102
|
+
`number_of_trees` | Number of trees to use in the forest | 100
|
103
|
+
`random_seed` | Random seed to use | 42
|
104
|
+
`parallel` | Enable parallel execution | false
|
105
|
+
|
106
|
+
Parameter values should always be passed as strings.
|
107
|
+
|
108
|
+
```c
|
109
|
+
rcf_set_param(forest, "parallel", "true");
|
110
|
+
```
|
111
|
+
|
112
|
+
`rcf_set_param` returns zero if successful and nonzero if the name or value is invalid or if it’s called after `rcf_score` or `rcf_update`.
|
113
|
+
|
114
|
+
## Reference
|
115
|
+
|
116
|
+
- [Robust Random Cut Forest Based Anomaly Detection On Streams](https://proceedings.mlr.press/v48/guha16.pdf)
|
117
|
+
|
87
118
|
## History
|
88
119
|
|
89
120
|
View the [changelog](CHANGELOG.md)
|
Binary file
|