Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,4 @@ myx_test/
# pixi environments
.pixi
*.egg-info
pyikt/_version.py
104 changes: 64 additions & 40 deletions README.md

Large diffs are not rendered by default.

29 changes: 27 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@

<!-- <div style="clear: both;"></div> -->

![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
[![PyPI](https://img.shields.io/pypi/v/pyikt)](https://pypi.org/project/pyikt/)
[![codecov](https://codecov.io/gh/IsolationKernel/pyikt/branch/master/graph/badge.svg)](https://codecov.io/gh/IsolationKernel/pyikt)
[![Build status](https://github.com/IsolationKernel/pyikt/actions/workflows/python-app.yml/badge.svg)](https://github.com/IsolationKernel/pyikt/actions/workflows/python-app.yml/badge.svg)
[![Project Status: Active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/IsolationKernel/pyikt/graphs/commit-activity)
[![Downloads](https://static.pepy.tech/badge/pyikt)](https://pepy.tech/project/pyikt)
[![Downloads](https://static.pepy.tech/badge/pyikt/month)](https://pepy.tech/project/pyikt)
[![License](https://img.shields.io/github/license/IsolationKernel/pyikt)](https://github.com/IsolationKernel/pyikt/blob/master/LICENSE)



## About The Project

**PyIKT** (Python for Isolation Kernel Toolkit) is an intuitive Python library designed for a variety of machine learning tasks including kernel similarity calculation, anomaly detection, clustering, and change detection—all powered by the innovative **Isolation Kernel (IK)** . Isolation Kernel is a data-dependent kernel that measures similarity by isolating data points using an isolation mechanism. It uniquely adapts to the data distribution, with the property that points in sparse regions are more similar than those in dense regions. Notably, it requires no learning or closed-form expression, making it efficient and scalable.
Expand Down Expand Up @@ -49,6 +61,19 @@ For more installation options, including dependencies and additional features, c

---

## Example

```py
# Anomaly Detection using inne.
import numpy as np
from pyikt.anomaly import INNE
X = np.array([[-1.1, 0.2], [0.3, 0.5], [0.5, 1.1], [100, 90]])
clf = INNE(contamination=0.25).fit(X)
clf.predict([[0.1, 0.3], [0, 0.7], [90, 85]])
```

---

## Implemented Algorithms

#### Summary
Expand Down Expand Up @@ -138,7 +163,7 @@ Explore our extensive list of examples and tutorials (English and Spanish) to ge

Primarily, PyIKT development consists of adding and creating new *Forecasters*, new validation strategies, or improving the performance of the current code. However, there are many other ways to contribute:

- Submit a bug report or feature request on [GitHub Issues](https://github.com/pyikt/pyikt/issues).
- Submit a bug report or feature request on [GitHub Issues](https://github.com/IsolationKernel/pyikt/issues).
- Contribute a Jupyter notebook to our [examples](./examples/examples_english.html).
- Write [unit or integration tests](https://docs.pytest.org/en/latest/) for our project.
- Answer questions on our issues, Stack Overflow, and elsewhere.
Expand Down Expand Up @@ -173,4 +198,4 @@ url = {https://github.com/IsolationKernel/pyikt}

## License

[BSD-3-Clause License](https://github.com/pyikt/pyikt/blob/master/LICENSE)
[BSD-3-Clause License](https://github.com/IsolationKernel/pyikt/blob/master/LICENSE)
3 changes: 1 addition & 2 deletions docs/quick-start/how-to-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pip install pyikt
Specific version:

```bash
pip install pyikt==0.01.0
pip install pyikt==0.1.0
```

Latest (unstable):
Expand All @@ -30,6 +30,5 @@ The following dependencies are installed with the default installation:
+ pandas>=1.5
+ tqdm>=4.57
+ scikit-learn>=1.2
+ optuna>=2.10
+ joblib>=1.1
+ numba>=0.59
21 changes: 0 additions & 21 deletions pyikt/_version.py

This file was deleted.

Empty file removed pyikt/base.py
Empty file.
48 changes: 24 additions & 24 deletions pyikt/stream/tests/test_streakhc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,27 @@ def test_streamkhc_purity():
assert 0 <= purity <= 1


def test_streamkhc_visualization_methods():
# Generate sample data
np.random.seed(42)
X = np.random.rand(10, 5)

# Fit model
clusterer = STREAMKHC(n_estimators=50, random_state=42)
clusterer.fit(X)

# Test methods without actually saving files
# Just ensure no exceptions are raised

with tempfile.NamedTemporaryFile(suffix=".png") as temp_img:
try:
clusterer.visualize_tree(temp_img.name)
except Exception as e:
if "GraphViz's executables" in str(e):
pytest.skip("GraphViz not installed, skipping visualization test")
else:
raise

with tempfile.NamedTemporaryFile(suffix=".json") as temp_json:
clusterer.serialize_tree(temp_json.name)
assert os.path.exists(temp_json.name)
# def test_streamkhc_visualization_methods():
# # Generate sample data
# np.random.seed(42)
# X = np.random.rand(10, 5)

# # Fit model
# clusterer = STREAMKHC(n_estimators=50, random_state=42)
# clusterer.fit(X)

# # Test methods without actually saving files
# # Just ensure no exceptions are raised

# with tempfile.NamedTemporaryFile(suffix=".png") as temp_img:
# try:
# clusterer.visualize_tree(temp_img.name)
# except Exception as e:
# if "GraphViz's executables" in str(e):
# pytest.skip("GraphViz not installed, skipping visualization test")
# else:
# raise

# with tempfile.NamedTemporaryFile(suffix=".json") as temp_json:
# clusterer.serialize_tree(temp_json.name)
# assert os.path.exists(temp_json.name)
2 changes: 1 addition & 1 deletion pyikt/trajectory/tests/test_ikat.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_IKAT_fit(trajectory_data, method):
assert hasattr(ikat, "offset_")


@pytest.mark.parametrize("method", ["inne", "anne"])
@pytest.mark.parametrize("method", ["inne"])
def test_IKAT_predict(trajectory_data, method):
ikat = IKAT(
n_estimators_1=100,
Expand Down
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ keywords = [
]

dependencies = [
"numpy<=1.22",
"pandas>=1.5",
"scikit-learn>=1.2",
"numba>=0.54",
"tqdm >=4.62.3",
"scikit-learn >= 1.2",
"pandas >= 1.5",
"numpy <= 1.22",
"numba >= 0.54",
"tqdm >= 4.62.3",
]

requires-python = ">=3.9"

[project.urls]
Expand All @@ -56,7 +57,7 @@ Documentation = "https://isolationkernel.github.io/pyikt/"
file = "LICENSE"

[build-system]
requires = ["setuptools>=61", "toml", "build"]
requires = ["setuptools>=61", "toml", "build", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"


Expand Down
Loading