Metadata-Version: 2.4
Name: ltcpy
Version: 1.0.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Summary: The Liftime Clustering (LTC) algorithm.
Keywords: clustering
Author-email: Balthasar Teuscher <balthasar.teuscher@tum.de>, Johann Maximilian Zollner <maximilian.zollner@tum.de>
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/tum-bgd/ltc

# Lifetime Clustering (LTC)

Efficient and robust topology-based clustering.

<p align="center">
<img src="/assets/graphical_abstract.jpg"/>
<figcaption>Graphical abstract of the LTC algorithm (JM Zollner, <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>).</figcaption>
</p>

## Example

This is a minimal example. See [installation](#installation) for how to install.

### Python

```python
from ltc import LifetimeClustering

data = ... # data
eps = ... # fixed-radius

ltc = LifetimeClustering(eps) # initialize
ltc.fit(data) # cluster

labels = ltc.labels_ # get labels
```
### Rust

To use directly in Rust, add it with `cargo add ltc-rs` as a dependency to your `Cargo.toml`.

```rust
let x: Vec<Vec<f32>> = ...; // data
let eps: f32 = ...; // fixed-radius

let (labels, lifetime) = ltc_rs::fit(&x,eps); // cluster
```

## Installation

Installing with [`PyPI`](https://pypi.org/project/ltc/)
```bash
pip install ltcpy
```

or build from source. [Rust](https://rust-lang.org/tools/install/) and [Maturin](https://www.maturin.rs/installation.html) are required.

```sh
pip install maturin
```

To build and install the `ltcpy` package locally, run:

```sh
maturin develop -m ltc-py/Cargo.toml --release
```

## Layout
| Path | Content |
| --- | --- |
| `./assets` | Example data |
| `./ltc-py` | Python bindings |
| `./ltc-rs` | Rust implementation |
| `./scripts` | Notebook with examples,  Python implementation |

## Reference

```bibtex
@article{ltc,
    author    = {Zollner, Johann M. and Teuscher, Balthasar and Mansour, Wejdene and Werner, Martin},
    title     = {Efficient and Robust Topology-Based Clustering},
}
```

## Funding

This work was supported by the German Federal Ministry of Research, Technology and Space under grant number 16DKWN134.

## License

The project is licensed under the [Apache-2.0 license](https://github.com/tum-bgd/ltc/blob/main/LICENSE) or [opensource.org/licenses/Apache-2.0](https://opensource.org/licenses/Apache-2.0).

