LibIsolationForest
Description
This project contains Rust, C++, and python implementations of the Isolation Forest algorithm. Isolation Forest is an anomaly detection algorithm based around a collection of randomly generated decision trees. For a full description of the algorithm, consult the original paper by the algorithm's creators:
https://cs.nju.edu.cn/zhouzh/zhouzh.files/publication/icdm08b.pdf
Python Example
The python implementation can be installed via pip:
pip install IsolationForest
Here's a short code snipet that shows how to use the Python version of the library. You can also read the file test.py for a complete example. As the library matures, I'll add more test examples to this file.
from isolationforest import IsolationForest
forest = IsolationForest.Forest(num_trees, sub_sampling_size)
sample = IsolationForest.Sample("Training Sample 1")
features = []
features.append({"feature 1": feature_1_value})
# Add more features to the sample...
features.append({"feature N": feature_N_value})
sample.add_features(features)
# Add the features to the sample.
forest.add_sample(sample)
# Add more samples to the forest...
# Create the forest.
forest.create()
sample = IsolationForest.Sample("Test Sample 1")
features = []
features.append({"feature 1": feature_1_value})
# Add more features to the sample...
features.append({"feature N": feature_N_value})
# Add the features to the sample.
sample.add_features(features)
# Score the sample.
score = forest.score(sample)
normalized_score = forest.normalized_score(sample)
Rust Example
An example of how to use the Rust version of the library can be found in main.rs. As the library matures, I'll add more test examples to this file.
C++ Example
An example of how to use the C++ version of the library can be found in main.cpp. As the library matures, I'll add more test examples to this file.
Version History
1.0
- Initial version.
1.1
- Added normalized scores.
- Updated random number generation in rust, because it changed again.
License
This library is released under the MIT license, see LICENSE for details.
Release files for IsolationForest 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| IsolationForest-1.1.0.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| IsolationForest-1.1.0-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 9.7 kB
Release files / IsolationForest-1.1.0.tar.gz
| Download URL | IsolationForest-1.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37aec4a4ce9f1ee7c5f2c26561351475f069a9246f63b174c00f0b21620e3a29
|
|
BLAKE2b-256 checksum How to use checksums |
5c95767b538c9ce90d00d550e29477f6ebdef6c431e7734c404991c051847513
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.15
|
Release files / IsolationForest-1.1.0-py2-none-any.whl
| Download URL | IsolationForest-1.1.0-py2-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
30a66f6bfe059e6b39031406d640c17000cb0730b9685cec96070710804a222f
|
|
BLAKE2b-256 checksum How to use checksums |
52e20d1b75969595e37564db1c6a21998ec3d73f7a704f23e2d4a4c9aba12423
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.15
|