Metadata-Version: 2.4
Name: tsne_pso
Version: 1.1.0
Summary: t-Distributed Stochastic Neighbor Embedding with Particle Swarm Optimization
Home-page: https://github.com/M-Allaoui/t-SNE-PSO
Author: Otmane Fatteh
Author-email: Otmane Fatteh <fattehotmane@hotmail.com>
License: BSD-3-Clause
Project-URL: Homepage, https://github.com/M-Allaoui/t-SNE-PSO
Project-URL: Bug Tracker, https://github.com/M-Allaoui/t-SNE-PSO/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.19.5
Requires-Dist: scipy>=1.6.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: umap-learn>=0.5.3
Requires-Dist: tqdm>=4.64.0
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# TSNE-PSO

t-Distributed Stochastic Neighbor Embedding with Particle Swarm Optimization (TSNE-PSO) is an enhanced version of t-SNE that uses Particle Swarm Optimization instead of gradient descent for the optimization step.

## Installation

```bash
pip install tsne-pso
```

## Usage

```python
from tsne_pso import TSNEPSO
import numpy as np
from sklearn.datasets import load_iris

# Load data
iris = load_iris()
X = iris.data

# Apply TSNE-PSO
tsne_pso = TSNEPSO(
    n_components=2,
    perplexity=30.0,
    n_particles=10,
    n_iter=500,
    random_state=42
)
X_embedded = tsne_pso.fit_transform(X)

# Visualize results
import matplotlib.pyplot as plt
plt.figure(figsize=(10, 8))
scatter = plt.scatter(X_embedded[:, 0], X_embedded[:, 1], c=iris.target)
plt.legend(handles=scatter.legend_elements()[0], labels=iris.target_names)
plt.title('TSNE-PSO visualization of Iris dataset')
plt.show()
```

## Features

- Uses Particle Swarm Optimization for better optimization
- Supports multiple initialization strategies (PCA, UMAP, t-SNE)
- Optional hybrid approach using both PSO and gradient descent
- Customizable parameters for optimization (particles, inertia, cognitive/social weights)

## Dependencies

- numpy
- scipy
- scikit-learn
- umap-learn (optional)
- tqdm (optional, for progress bars)

## Citation

If you use this package in your research, please cite the following paper:

```bibtex
@article{allaoui2025t,
  title={t-SNE-PSO: Optimizing t-SNE using particle swarm optimization},
  author={Allaoui, Mebarka and Belhaouari, Samir Brahim and Hedjam, Rachid and Bouanane, Khadra and Kherfi, Mohammed Lamine},
  journal={Expert Systems with Applications},
  volume={269},
  pages={126398},
  year={2025},
  publisher={Elsevier}
}
```

## License

BSD-3-Clause License (same as scikit-learn) 
