Skip to main content

Coniferous forests for better machine learning

Project description

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.

asciicast

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. Most of the benchmarks have n_jobs fixture set to 1 by default, you can change it with --n_jobs option. 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.

Citation

If you found this project useful for your research, please cite Kornilov, Korolev, Malanchev, et al., 2025

@article{Kornilov2025,
	title = {Coniferest: A complete active anomaly detection framework},
	journal = {Astronomy and Computing},
	volume = {52},
	pages = {100960},
	year = {2025},
	issn = {2213-1337},
	doi = {10.1016/j.ascom.2025.100960},
	url = {https://www.sciencedirect.com/science/article/pii/S2213133725000332},
	author = {M.V. Kornilov and V.S. Korolev and K.L. Malanchev and A.D. Lavrukhina and E. Russeil and T.A. Semenikhin and E. Gangler and E.E.O. Ishida and M.V. Pruzhinskaya and A.A. Volnova and S. Sreejith},
}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

coniferest-0.1.1-cp310-abi3-win_amd64.whl (239.9 kB view details)

Uploaded CPython 3.10+Windows x86-64

coniferest-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (336.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

coniferest-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (320.6 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

coniferest-0.1.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (629.0 kB view details)

Uploaded CPython 3.10+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file coniferest-0.1.1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: coniferest-0.1.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 239.9 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for coniferest-0.1.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f0710747bbe3fa36084d1aa0285b8bf0e992004a8d97dfc95efc2cf555fdd849
MD5 b2db1e1491983c41cbb65f3da5abc71e
BLAKE2b-256 3990106dfa23d5e40bbb9f28b36d34d20f7caf2f7bebcf1f311ab79d502871da

See more details on using hashes here.

File details

Details for the file coniferest-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for coniferest-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea26be4954562e6a1e48db1947291752feb503bfe2f2ca7149d7b8c8dcf8d866
MD5 bd904423c3b0ec0de4c1a7a35daec7cc
BLAKE2b-256 810d55a0041760eb472dbbfc4537db217df02e4dbff2e9b7cdcf03bff53ff40a

See more details on using hashes here.

File details

Details for the file coniferest-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for coniferest-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7d50bbf045f2ec8c988c485f5489ab33657db06e1636900628005055c97107e8
MD5 fbecdbf3a582a541d74c9adcba8036ad
BLAKE2b-256 43ba02788a79564b7bf8b6112bf8f84ff269200e83bacae2e92113a7500bdcfc

See more details on using hashes here.

File details

Details for the file coniferest-0.1.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for coniferest-0.1.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 455b28c47479eb2f39bef4cce1e81cbc42dd67d3e62dbe6f8736b4f465a493fe
MD5 d6978b35c4ebc0604bb6c889ff45d928
BLAKE2b-256 2c1561a3105e64c14e28ee268c6e844dc04b9212dd74d54414cc4e270c5b1384

See more details on using hashes here.

Supported by

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