Skip to main content

t-Distributed Stochastic Neighbor Embedding with Particle Swarm Optimization

Project description

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

pip install tsne-pso

Usage

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)

License

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

Project details


Download files

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

Source Distribution

tsne_pso-1.0.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsne_pso-1.0.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file tsne_pso-1.0.0.tar.gz.

File metadata

  • Download URL: tsne_pso-1.0.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for tsne_pso-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8635746fdafeb9f5f42060dc632bb2473bf78be5d67ddedf60602597b07c058f
MD5 8341c27301f8d873df78d89a770d7256
BLAKE2b-256 68f2771b1d8a3d45a23768226e0067ad7ce257b11789d04a4fd061814e5b8464

See more details on using hashes here.

File details

Details for the file tsne_pso-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tsne_pso-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for tsne_pso-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b701f00f1734babc38799382b1ca4dde4b8668381b78f38e4c66db7de4f2afe
MD5 80e6329d1cf42224a281b6de7451dd97
BLAKE2b-256 8bb6ba154f2ccbcdfb1704ab05982f438821aa060e7c05a025a54e62ec06f472

See more details on using hashes here.

Supported by

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