What is scipy.cluster.hierarchy.fcluster()method?

ScipyScientific ComputingProgramming

scipy.cluster.hierarchy.fcluster(Z,t,criterion=’inconsistent’depth=2,R=None, monocrat=None)− The fcluster() method forms flat clusters from the hierarchical clustering. This hierarchical clustering is defined by the given linkage matrix, identifying a link between clustered classes.

Below is given the detailed explanation of its parameters −

Parameters

  • Z− ndarray

    It represents the hierarchical clustering which is encoded with the linkage matrix.

  • t− scalar

    The value of t depends on the type of criteria. For ‘inconsistent’, ‘distance’, and ‘monocrit’ criteria, the value of t represents the threshold to apply when forming flat clusters. On the other hand, for ‘maxclust’, and ‘maxclust_monocrit’ criteria, the value of t represents the maximum number of clusters requested.

  • criterion− str, optional

This parameter represents the criterion to use in forming flat clusters. The values of criterion can be any one among the followings −

  • inconsistent− Inconsistent criterion means that the cluster node and all its descendants have an inconsistent value less than or equal to the value of t. In such case, the leaf descendants of cluster node will belong to the same flat cluster. Whereas, if this is not the case then every node will be assigned to its own cluster.

  • distance− The criterion distance will form flat clusters having condition that the original observations in each flat cluster have cophenetic distance equal to or less than t.

  • maxclust− The criterion maxclust will find a minimum threshold value r. It assures that the cophenetic distance between any two original observations in the same flat clusters will always be less than or equal to r and t.

  • monocrit− The criterion monocrit will form a flat cluster from a cluster node with index i when monocrit[i] <=t.

  • maxclust_monocrit− The criterion maxclust_monocrit will form a flat cluster from a non-singleton cluster node with index i when monocrit[i] <=r.

  • depth− int, optional

    This parameter represents the maximum depth to perform the inconsistency calculation. The default value of depth parameter is 2 and it has no meaning for any other criteria.

  • R− ndarray, optional

    This parameter represents the inconsistency matrix to be used for the inconsistent criterion. The default value is NONE and if it is not provided then the matrix will be computed.

  • monocrit− ndarray, optional

    This parameter is an array length of n-1.

Returns

  • flcuster− ndarray

    It returns an array of length n.

raja
Updated on 25-Nov-2021 06:43:02

Advertisements