resclu is used to cluster data without supervision dynamically
Project description
Recursive cluster
Description
Welcome to the Dynamic Clustering package : ) This package provides a comprehensive solution for dynamic clustering of multidimensional data using KMeans, the Elbow method for identifying optimal clusters, and a recursive approach to build hierarchical clusters. We'll guide you installing and using the package effectively.
Features
- PCPTest: Use permutation test to determine whether a dataset can be clustered
- Dynamic Clustering: Performs hierarchical clustering using recursive methodologies.
- Cluster Stability Validation: Implements predictive cohesion and PCA variance tests to validate cluster stability via a Predictive Cohesion Partition Test.
- Optimal Cluster Identification: Finds the optimal number of clusters based on an Elbow method assessment.
- Dimensionality Reduction: Reduces the dimensionality of input data using Principal Component Analysis (PCA).
- Definition-Based Data Transformation: Provides functions to convert hierarchical cluster paths into pandas DataFrame and prune tree levels if required.
Installing
To use this package, please enter the following the code in your command line window.
pip install recursivecluster
Enter the following code in your python.
from resclu import *
Example:
Here's a step-by-step guide to using the package with an example data fole. 1.Data Preparation: Load your dataset into a pandas DataFrame. Get Example dataset at: https://github.com/zondaxyz/resclu/blob/main/ECCBCluster01.csv (A preprocessed dataset from: https://www.kaggle.com/datasets/hunter0007/ecommerce-dataset-for-predictive-marketing-2023) Notice:The data must be of numerical type, it cannot contain strings. 2. Import resclu package
from resclu import *
# Load your dataset
data = pd.read_csv('ECCBCluster01.csv')
- Perform Recursive Clustering: Apply dynamic clustering recursively to achieve hierarchical clustering.
a = recursive_cluster(data,max_depth=6,PCAtoN=True,pth=0.01)
#Remove levels that do not meet the minimum presence threshold.
a = labels_to_dataframe(a)
#cut level
a = cutlevel(a)
- demonstrate result
print(a)
Parameter of Recursive_cluster( )
-
df: This is the input pandas DataFrame that needs to be clustered. -
max_depth: This is an optional integer that sets the maximum depth of recursion. The default value is 10, which means the function can create a hierarchical clustering structure up to 10 levels deep. -
sti1: This is a parameter for the PCPTest function, controlling the number of bootstrap iterations. The default value is 100. -
sti2: This is a parameter for the PCPTest function, controlling the number of iterations for the 'predcoh' or 'pcavar' functions. The default value is 30. -
pth: This is a parameter for the PCPTest function, setting the threshold for the p-value. The default value is 0.05. -
PCAtoN: This is a boolean value that determines whether to use PCA for dimensionality reduction. The default value is True. -
n_pca: This is the target dimension for PCA dimensionality reduction. The default value is None, which means the function will automatically select a dimension such that the retained principal components can explain 95% of the variance in the original data. -
hitvar: This is the variance explanation threshold for PCA dimensionality reduction whenn_pcais None. The default value is 0.95. -
inu: This is a boolean value that determines whether to perform sampling without replacement during the bootstrap process. The default value is False. -
fun: This is the function used for PCPTest, which can be 'predcoh' or 'pcavar'. The default value is 'predcoh'. -
faster: This is a boolean value that determines whether to use a faster method for clustering. The default value is False.
Parameter of cutlevel( )
t: This is the threshold used to decide whether to drop a column. If the proportion of non-null values in a column is less than this threshold, the column will be dropped. The default value is 0.1.
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 resclu-0.1.2.tar.gz.
File metadata
- Download URL: resclu-0.1.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73b411eafcb186dfee97603bef290835eb704a21d319dd1766c784f31b0f09bb
|
|
| MD5 |
2ac2561fc5d99122b6ca8b8cf5ed619b
|
|
| BLAKE2b-256 |
c79073c9eb6cbc3957718293616c66b3293f00d69775406b757e290e9892b37c
|
File details
Details for the file resclu-0.1.2-py3-none-any.whl.
File metadata
- Download URL: resclu-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e22451e7392ebf4fa9423d05572fe7ea2f1a0355c78ae81470df199dbef81117
|
|
| MD5 |
6ea9dd44b300fc3b096ebd3ddce04ac6
|
|
| BLAKE2b-256 |
a63ee1f72474178d6c5762f477068c12784877cfe048b45e90206fbe95d7103b
|