Universal clustering based on dialectical materialism
Project description
DRUHG
Basic Concept
How to use DRUHG
import sklearn.datasets as datasets
import druhg
iris = datasets.load_iris()
XX = iris['data']
clusterer = druhg.DRUHG(max_ranking=50)
labels = clusterer.fit(XX).labels_
It will build the tree and label the points. Now you can manipulate clusters by relabeling.
labels = dr.relabel(limit1=1, limit2=len(XX)/2, fix_outliers=1)
ari = adjusted_rand_score(iris['target'], labels)
print ('iris ari', ari)
It will relabel the clusters, by restricting their size.
from druhg import DRUHG
import matplotlib.pyplot as plt
import pandas as pd, numpy as np
XX = pd.read_csv('chameleon.csv', sep='\t', header=None)
XX = np.array(XX)
clusterer = DRUHG(max_ranking=200)
clusterer.fit(XX)
plt.figure(figsize=(30,16))
clusterer.minimum_spanning_tree_.plot(node_size=200)
It will draw mstree with druhg-edges.
Performance
Installing
PyPI install, presuming you have an up to date pip:
pip install druhg
Running the Tests
The package tests can be run after installation using the command:
pytest -s druhg
or
python -m pytest -s druhg
The tests may fail :-D
Python Version
The druhg library supports both Python 2 and Python 3.
Contributing
We welcome contributions in any form! Assistance with documentation, particularly expanding tutorials, is always welcome. To contribute please fork the project make your changes and submit a pull request. We will do our best to work through any issues with you and get your code merged into the main branch.
Licensing
The druhg package is 3-clause BSD licensed.
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
File details
Details for the file druhg-1.5.0.tar.gz.
File metadata
- Download URL: druhg-1.5.0.tar.gz
- Upload date:
- Size: 477.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7278ee63558ecee53c87c0b93ed335850bb5e6ebe6bee9d176580d758b77503e
|
|
| MD5 |
32bb75d4156a5614527267eaf6681ce7
|
|
| BLAKE2b-256 |
8cf98c8cd44443fc900bce226fa9d09c0ba77dfaf53bd1d6ebe8dfb676e7c697
|