Installation Instructions
Run following code in terminal: python3 -m pip install bayesHC1
Then import package and load cython as follows: import bayesHC1
Documentation
bayesHC.bayes_hier_clust(data_vec, alpha, alpha0, beta, kappa, mu)
Given a tuple of datapoints, build a hierarchical cluster tree. Algorithm will continue merging clusters until there is only one overarching cluster. This algorithm is recommended for clustering $<$23 observations.
Parameters: alpha : the expected number of clusters
alpha0 : scale hyperparameter for gamma prior
beta : location hyperparameter for gamma prior
kappa : precision hyperparameter for normal prior
mu : mean hyperparameer for normal prior
Returns:nested tuple
Returns a tuple with the following structure: cluster = (c_num,left,right,value,n_k,p_k,d_k)
Where:
c_num : the number of the cluster
left : the entire cluster tuple for one subcluster
right : the entire cluster tuple for the other subcluster
value : all data values included in the cluster
n_k : number of datapoints in the cluster
p_k : the prior on merging
d_k : a weight on the volume of data in pairs of clusters on the subtree T_k
Example
<<<import pandas as pd <<<df_sim = pd.read_table('simulated_data.csv',delimiter = ",") <<<value = tuple([points] for points in df_sim.loc[:4,'values']) <<<mu, kappa = 0, 100 # mean and standard deviation <<<alpha, beta = 2,10 # scale and location <<<z = bayes_hier_clust(value, alpha, beta, kappa,mu) <<<z
[(9, (4, 0, 0, [24.649825190000001], 1, 1, 2.0), (8, (5, 0, 0, [20.543137890000001], 1, 1, 2.0), (7, (1, 0, 0, [19.404575810000001], 1, 1, 2.0), (6, (2, 0, 0, [4.4017292919999997], 1, 1, 2.0), (3, 0, 0, [10.766117830000001], 1, 1, 2.0), [4.4017292919999997, 10.766117830000001], 2, 0.3333333432674408, 6.0), [19.404575810000001, 4.4017292919999997, 10.766117830000001], 3, 0.25, 16.0), [20.543137890000001, 19.404575810000001, 4.4017292919999997, 10.766117830000001], 4, 0.27272728085517883, 44.0), [24.649825190000001, 20.543137890000001, 19.404575810000001, 4.4017292919999997, 10.766117830000001], 5, 0.3529411852359772, 136.0)]
z[1] (4, 0, 0, [24.649825190000001], 1, 1, 2.0)
Last updated on April 30, 2019.
Metadata
Release files for bayesHC1 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bayesHC1-0.0.1.tar.gz | 4.4 kB | Without provenance | Details for bayesHC1-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bayesHC1-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for bayesHC1-0.0.1-py3-none-any.whl |
Total release size: 9.7 kB
Release files / bayesHC1-0.0.1.tar.gz
| Download URL | bayesHC1-0.0.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
868d84080ed5abcc96897300959af7959c9c5bc9004e0df9a8947ad69d936e0e
|
|
BLAKE2b-256 checksum How to use checksums |
e1848dea75673d3141002e5188a7a65526ffef9379dd24a1862b789e05e4bfef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
|
Release files / bayesHC1-0.0.1-py3-none-any.whl
| Download URL | bayesHC1-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ce4630c5de195d0407a75c7bef561da36c0acc7b56f0ca2b26a0d01b60bf214
|
|
BLAKE2b-256 checksum How to use checksums |
211e8d10b5dc233af8712d43be77ac12fe1ec18843ce3ef672ccfaebf94d450c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
|
Security for bayesHC1 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.