dendrogram
is a toolkit for creating N-dimensional (ND) dendrogram. See documentation for details.
Placeholder
The prerequisites of dendrogram
are
python >= 3.8
numpy >= 1.18
Lower versions may also work (and higher versions may not work). Please raise an issue if it doesn't work for you. Next, you can git clone
the source package from GitHub:
$ git clone https://github.com/EnthalpyBill/Dendrogram.git
To build and install dendrogram
, cd
the folder and pip install
it:
$ cd Dendrogram/
$ pip install -e .
The -e
command allows you to make changes to the code. Remove it if you don't want to do so. dendrogram
has not been published to PyPI
yet.
To use the package, import it as
>>> import dendrogram as dg
Let's consider a simple two-dimensional bimodal data.
>>> data = np.array([[2,1], [1,2]])
>>> print(data)
[[2 1]
[1 2]]
We can easily generate the dendrogram tree with the following command:
>>> tree = dg.makeTree(data, min_value=0)
min_value
specifies the minimum value to consider when making the tree, and print_progress
determines whether to print the progress or not. Other arguments include
min_delta
(scalar, default to 0): Lag to be ignored.min_npix
(int, default to 1): Minimum number of pixels to form a cluster.num_level
(int, default to 100): Number of levels.print_progress
(bool, default to False): Whether to print progress or not.
The makeTree()
method returns a dendrogram.structureTree.clusterTree
object. To visualize it, use the following command to show the topology of the tree:
>>> tp = tree.topology()
└──(-1)
└──(2)
├──(0)
└──(1)
As expected, two branches labeled 0 and 1 illustrates the bimodality. See Module API for more details about makeTree()
.
Feel free to dive in! Raise an issue or submit pull requests.
This README file is based on Standard Readme.
dendrogram
is available at GitHub under the MIT license.