Skip to main content

Coniferous forests for better machine learning

Project description

coniferest

PyPI version Documentation Status Test Workflow Build and publish wheels pre-commit.ci status

Package for active anomaly detection with isolation forests, made by SNAD collaboration.

It includes:

  • IsolationForest - reimplementation of scikit-learn's isolation forest with much better scoring performance due to the use of Cython and multi-threading (the latter is not currently available on macOS).
  • AADForest - reimplementation of Active Anomaly detection algorithm with isolation forests from Shubhomoy Das' ad_examples package with better performance, much less code and more flexible dependencies.
  • PineForest - our own active learning model based on the idea of tree filtering.

Install the package with pip install coniferest.

See the documentation for the Tutorial.

Installation

The project is using Cython for performance and requires compilation. However, binary wheels are available for Linux, macOS and Windows, so you can install the package with pip install coniferest on these platforms with no build-time dependencies. Currently multithreading is not available in macOS ARM wheels, but you can install the package from the source to enable it, see instructions below.

If your specific platform is not supported, or you need a development version, you can install the package from the source. To do so, clone the repository and run pip install . in the root directory.

Note, that we are using OpenMP for multi-threading, which is not available on macOS with the Apple LLVM Clang compiler. You still can install the package with Apple LLVM, but it will be single-threaded. Alternatively, you can install the package with Clang from Homebrew (brew install llvm libomp) or GCC (brew install gcc), which will enable multi-threading. In this case you will need to set environment variables CC=gcc-12 (or whatever version you have installed) or CC=$(brew --preifx llvm)/bin/clang and CONIFEREST_FORCE_OPENMP_ON_MACOS=1.

Development

You can install the package in editable mode with pip install -e .[dev] to install the development dependencies.

Linters and formatters

This project makes use of pre-commit hooks, you can install them with pre-commit install. Pre-commit CI is used for continuous integration of the hooks, they are applied to every pull request, and CI is responsible for auto-updating the hooks.

Testing and benchmarking

We use tox to build and test the package in isolated environments with different Python versions. To run tests locally, install tox with pip install tox and run tox in the root directory. We configure tox to skip long tests.

The project uses pytest as a testing framework. Tests are located in the tests directory, and can be run with pytest tests in the root directory. By default, all tests are run, but you can select specific tests with -k option, e.g. pytest tests -k test_onnx.test_onnx_aadforest. You can also deselect a specific group of tests with -m option, e.g. pytest tests -m'not long', see pyproject.toml for the list of markers.

We use pytest-benchmark for benchmarking. You can run benchmarks with pytest tests --benchmark-enable -m benchmark in the root directory. You can adjust the minimum number of iterations with --benchmark-min-rounds and maximum execution time per benchmark with --benchmark-max-time (note that the latter can be exceeded if the minimum number of rounds is not reached). See pyproject.toml for the default benchmarking options. You can make a snapshot the current benchmark result with --benchmark-save=NAME or with --benchmark-autosave, and compare benchmarks with pytest-benchmark compare command.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coniferest-0.0.13.tar.gz (9.0 MB view hashes)

Uploaded Source

Built Distributions

coniferest-0.0.13-cp311-cp311-win_amd64.whl (9.1 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

coniferest-0.0.13-cp311-cp311-win32.whl (9.1 MB view hashes)

Uploaded CPython 3.11 Windows x86

coniferest-0.0.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

coniferest-0.0.13-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

coniferest-0.0.13-cp311-cp311-macosx_11_0_arm64.whl (9.2 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

coniferest-0.0.13-cp311-cp311-macosx_10_9_x86_64.whl (9.5 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

coniferest-0.0.13-cp310-cp310-win_amd64.whl (9.1 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

coniferest-0.0.13-cp310-cp310-win32.whl (9.1 MB view hashes)

Uploaded CPython 3.10 Windows x86

coniferest-0.0.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

coniferest-0.0.13-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

coniferest-0.0.13-cp310-cp310-macosx_11_0_arm64.whl (9.2 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

coniferest-0.0.13-cp310-cp310-macosx_10_9_x86_64.whl (9.5 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

coniferest-0.0.13-cp39-cp39-win_amd64.whl (9.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

coniferest-0.0.13-cp39-cp39-win32.whl (9.1 MB view hashes)

Uploaded CPython 3.9 Windows x86

coniferest-0.0.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

coniferest-0.0.13-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

coniferest-0.0.13-cp39-cp39-macosx_11_0_arm64.whl (9.2 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

coniferest-0.0.13-cp39-cp39-macosx_10_9_x86_64.whl (9.5 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page