Metadata-Version: 2.5
Name: metalc
Version: 0.1.0
Summary: Ensemble topic modelling (LDA and NMF-GKL) for microbiome ASV tables: pooled topics clustered into meta-LCs in a shared Hellinger geometry, then fixed-W inference.
Requires-Python: <3.14,>=3.11
Requires-Dist: anywidget>=0.11.0
Requires-Dist: datamapplot>=0.5
Requires-Dist: fast-hdbscan>=0.3.2
Requires-Dist: gensim>=4.4.0
Requires-Dist: joblib>=1.3
Requires-Dist: kaleido>=1.3.0
Requires-Dist: kmedoids>=0.5.5
Requires-Dist: lda4microbiome>=1.0.1
Requires-Dist: matplotlib>=3.10.9
Requires-Dist: numpy>=1.24
Requires-Dist: pandas<3.0.0,>=2.0.3
Requires-Dist: plotly>=5.0
Requires-Dist: scikit-learn>=1.8.0
Requires-Dist: scipy>=1.11
Requires-Dist: ssnmf==0.0.2
Requires-Dist: traitlets>=5.0
Requires-Dist: umap-learn>=0.5.12
Requires-Dist: zadu>=0.4.2
Description-Content-Type: text/markdown

# metalc

![metalc](doc/metalc_logo_onwhite.png)

MetaLC implement a robust mixed-membership model and lets domain knowledge
into the loop: ensemble topics are pooled and clustered into stable
**meta-LCs**, which you then use to build a model that describes your data.

## Install

```bash
pip install metalc
```

## Usage

```python
import metalc as mlc
```

### 1. Fit an ensemble

Supports LDA and NMF.

```python
ensemble = mlc.run_ensemble(df, [2, 10], method="lda",
                            taxonomy=taxa_df,      # feature-indexed; annotation only
                            cache_dir=".../lda_ensemble_results")
```

### 2. Select a layer and look at it

```python
ensemble.layers()
e = ensemble[2]

mlc.plot_meta(e, view="profile", rank="Genus", profile="medoid", coherence=True)
mlc.plot_meta(e, view="umap",    rank="Genus", profile="medoid")
```

### 3. Freeze the meta-LCs and infer H

```python
result = mlc.inference(e, metadata, meta_lc_list=[0, 3, 4], profile="medoid")
result.H   # samples x meta-LC, rows sum to 1
result.W   # meta-LC x feature (the frozen dictionary)
```
