dendrogram: N-Dimensional Dendrogram

version license docs

dendrogram is a toolkit for creating N-dimensional (ND) dendrogram. See documentation for details.

Table of Contents

  • Intro

  • Install

  • Usage

  • Contribute

    • Authors

    • Maintainers

  • License

Intro

Placeholder

Install

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.

Usage

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 = 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().

Contribute

Feel free to dive in! Raise an issue or submit pull requests.

License

dendrogram is available at GitHub under the MIT license.