sledgehammer

Project Author Python Version License

SLEDgeHammer (SLEDgeH): Support, Length, Exclusivity and Difference Weigthed for Group Evaluation

SLEDgeH is a Python library for evaluating clustering results using a semantic-based approach. Unlike traditional distance-based metrics, this method leverages the semantic relationship between significant frequent patterns identified among cluster items. This internal validation technique is particularly effective for data organized in categorical form.


🔥 Features


🛠 Installation

Install using git and pip install:

pip install git+https://github.com/aquinordg/sledgehammer.git


🚀 Usage

Importing the Library

import pandas as pd
import numpy as np
from sledgehammer import sledgehammer_score, sledgehammer_score_clusters, semantic_descriptors

Example Workflow

# Generate a random binary dataset
X = np.random.randint(0, 2, (100, 5))

# Specify the number of clusters
num_clusters = 3

# Perform K-Means clustering
kmeans = KMeans(n_clusters=num_clusters, random_state=42)
labels = kmeans.fit_predict(X)

# Calculate the SLEDgeH score
average_score = sledgehammer_score(X, labels, aggregation='median')
print(f"Average SLEDgeH Score: {average_score}\n")

# Generate semantic descriptors
report = semantic_descriptors(X, labels, particular_threshold=0.5, report_form=True)

# Print cluster descriptors
for i in range(num_clusters):
    print(f"Cluster {i}:\n{report[i]}\n")

📜 Functions Overview

sledgehammer_score

Computes the average SLEDgeH score for all clusters.

Parameters:

Returns:


sledgehammer_score_clusters

Computes the SLEDgeH score for individual clusters.

Parameters:

Returns:


semantic_descriptors

Computes semantic descriptors based on feature support in clusters.

Parameters:

Returns:


particularize_descriptors

Particularizes descriptors based on support thresholds.

Parameters:

Returns:


📄 License

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


🤝 Contributing

We welcome contributions to SLEDgeH! To contribute:

  1. Fork this repository.
  2. Create a new branch for your feature.
  3. Submit a pull request with your changes.

For questions or information, feel free to reach out at: aquinordga@gmail.com.


👨‍💻 Author

Developed by AQUINO, R. D. G. Lattes ORCID Google Scholar


💬 Feedback

Feel free to open an issue or contact me for feedback or feature requests. Your input is highly appreciated!