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:
nosetests -s druhg
or, if nose is installed but nosetests is not in your PATH variable:
python -m nose -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 Distributions
Built Distribution
Hashes for druhg-1.0.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 946e42c154007dd2b0257556eca8424b007b8d8d05bae6a9151fea38eec2d700 |
|
MD5 | d07db8aff892f1f71989aa96268a7f80 |
|
BLAKE2b-256 | 9b82c5ba41e74716192abce91f05e77e8beb1d3f4825776d1cde561b760d3487 |