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-0.1.0.tar.gz (13.8 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-0.1.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tsne_pso-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72a37d3cc2416e49d529ea3d9b66b04f7c4675e9630ad760ed0a225dac4ec671
MD5 b3b634eef585e7a8788a8e224b01b3fd
BLAKE2b-256 ef0453098e4899bcfc5fa60085d8bc922fc5bd8020f8a1f29f0f39df62522367

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tsne_pso-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 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-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 964d0f7fe96b9622ce71cd615b21f307310ef56784890ae1f45780f20ba43303
MD5 4068e407f8df2e632b563f504b05a4e9
BLAKE2b-256 411e771ff2be9c765d15f39ba0359e5067ebe7f7b8ad8ba2599f86d403890cd5

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