Skip to main content

Implements the USL Technique for embeddings of any data, be it text, image, etc.

Project description

Unsupervised Learning for Embedding (USL)

This project implements the USL and USL-t methods for unsupervised learning with embeddings, allowing the use of embeddings to form clusters and potentially improve learning outcomes in unsupervised settings.

Installation

Clone the repository and install the required packages:

git clone [URL_to_this_repo]
cd [repo_name]
pip install -r requirements.txt

Usage

The usl_for_embedding function is designed to process embedding arrays for clustering. It can be used directly by importing from the selective_labeling.py:

from selective_labeling import usl_for_embedding

# Example usage:
embeddings = # your embedding data here
method = 'usl'  # or 'usl-t'
n_clusters = 5  # number of clusters to form

selected_indices = usl_for_embedding(embeddings, method=method, n_clusters=n_clusters)
print("Selected indices for clustering:", selected_indices)

Parameters

  • embeddings (array-like): Input data, embeddings to be clustered.
  • method (str): The clustering method to use ('usl' or 'usl-t').
  • n_clusters (int): Number of clusters to form.
  • Additional parameters include learning rate, batch size, initialization runs, regularization term, and more described in main.py.

Project Structure

project_root/
│
├── methods/                # Module for clustering algorithms
│   ├── usl.py              # Contains the density regulation based USL
│   └── usl_t.py            # Contains the transformer based USL-t
│
├── models/                 # Models used in USL-t
│   └── ssl_t_models/
│       └── clustering_model.py  # Clustering model for USL-t
│
└── main.py                 # Main script to use USL methods

Main Files and Their Roles

  • main.py: Contains the primary functions used to interface with the USL methods and demonstrates an example usage.
  • usl.py and usl_t.py: Implementation of the USL and USL-t methods, respectively.
  • clustering_model.py: Defines the neural network models used in the USL-t method.

Contributing

Contributions to this project are welcome. Please fork the repository and submit a pull request with your features or fixes.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Replace `[URL_to_this_repo]` and `[repo_name]` with your actual repository URL and name. This README provides a clear overview of how to set up and use the project, and details the files and their functions within the project structure.

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

usl_embedding-0.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

usl_embedding-0.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: usl_embedding-0.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for usl_embedding-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5af9ff5e36853bcc27913f728f77a7cb5059e12d2c785aba281f7e81d1b16d53
MD5 4136c2502d7251ec2e1673e41ab31e75
BLAKE2b-256 6255e016548140843925e04f13db2f43aa1a77fd0a0e6f0c2bd985aa805b2fd5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: usl_embedding-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for usl_embedding-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8ccaa8f0043963bcfef5a5e6fbe0a78aaf9af77004782a886059e283b8822ff
MD5 aeb1720bc1053dc999c9b3b4ffd25658
BLAKE2b-256 a044ce7673789dfb1c5d4cca14fb5484e93988987c3f5b448c5935bbf0e95832

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