No project description provided
Project description
QUANTICS Class Documentation
Overview
The QUANTICS class provides methods for data normalization, dimensionality reduction, clustering, and extracting representative samples from clustered data.
Methods
__init__(self, dataset)
Initializes the QUANTICS object with a dataset.
Parameters:
dataset: The input dataset, which must be either a numpy array or a pandas dataframe.
Raises:
ValueError: If the dataset is neither a numpy array nor a pandas dataframe.
normalize(self, normalize_method='z-score', **args)
Normalizes the dataset.
Parameters:
normalize_method: The normalization method to use. It can be either 'z-score' or 'minmax'. (default is 'z-score')**args: Additional arguments to pass to the scaler.
Raises:
ValueError: If an invalid normalization method is provided.
reduce_dim(self, reduction_method='pca', dim_size=2, **args)
Performs dimensionality reduction on the normalized dataset.
Parameters:
reduction_method: The reduction method to use. It can be either 'pca', 'tsne', or 'umap'. (default is 'pca')dim_size: The number of dimensions to reduce to. (default is 2)**args: Additional arguments to pass to the reduction algorithm.
Raises:
ValueError: If an invalid reduction method is provided.
cluster(self, min_k=2, max_k=10, **args)
Clusters the reduced data using KMeans and determines the best number of clusters based on the maximum silhouette score.
Parameters:
min_k: The minimum number of clusters to consider. (default is 2)max_k: The maximum number of clusters to consider. (default is 10)**args: Additional arguments to pass to the KMeans algorithm.
Raises:
ValueError: If the reduced data is not available.
get_representative_samples(self, no_samples=5)
Extracts representative samples based on the clustered data.
Parameters:
no_samples: The number of representative samples to extract. (default is 5)
Returns:
- A subset of the original dataset containing the representative samples.
Raises:
ValueError: If no clustering model has been fit.
Example Usage
import numpy as np
import pandas as pd
from quantics import QUANTICS
dataset = np.random.rand(100, 5)
processor = QUANTICS(dataset)
processor.normalize(normalize_method='Z-Score', with_mean=False)
processor.reduce_dim(reduction_method='PCA', dim_size=2, svd_solver='full')
processor.cluster(min_k=2, max_k=10, random_state=42)
samples = processor.get_representative_samples(no_samples=5)
print(samples)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantics-0.2.0.tar.gz.
File metadata
- Download URL: quantics-0.2.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec14e3fe4acc3117b85e1f614d5214fa15395d6001b297b54a58a94cd698f636
|
|
| MD5 |
46dd5ce2bd4f9e5a9d56faf593d12568
|
|
| BLAKE2b-256 |
8af7140f12ddeb7f6525b2bc8af278d175872ee895e66d079e13aabe80afe4bd
|
File details
Details for the file quantics-0.2.0-py3-none-any.whl.
File metadata
- Download URL: quantics-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f369af2193422dc0295c32094659a652fa21b7d3463c2e178d63735b52e7638
|
|
| MD5 |
0ac09d05c363018b15546650f6284a29
|
|
| BLAKE2b-256 |
8c1102fb554031c33f8da5ffba93bae4d0696603b28f43a0eeb5e0ba809d6aec
|