freediscovery.cluster.birch_hierarchy_wrapper

freediscovery.cluster.birch_hierarchy_wrapper(birch, container=<class 'freediscovery.cluster.hierarchy.BirchSubcluster'>, validate=True, compute_document_id=True)[source]

Wrap BIRCH cluster hierarchy with a container class

This class as inpu

Parameters:
  • birch (freediscovery.cluster.Birch) – a trained Birch clustering
  • container (freediscovery.cluster.BirchSubcluster, default=BirchSubcluster) – a subclass of BirchSubcluster that will be used to wrap each BIRCH subcluster
  • validate (bool, default=True) – check the consistency of the constructed hierarchical tree (this may carry some overhead)
  • compute_document_id (bool, default=True) – compute the document/sample ids belonging to each subcluster
Returns:

  • htree (BirchSubcluster) – a container containing the data from the BIRCH cluster hierarchy
  • n_subclusters (int) – the total number of subclusters

Note

in FreeDiscovery BIRCH if primairly used to cluster documents. As a result the variables/methods containing the term “document” have the same meaning as “sample” in the general scikit-learn context.

Examples using freediscovery.cluster.birch_hierarchy_wrapper