watex.utils.plot_naive_dendrogram#

watex.utils.plot_naive_dendrogram(X, *ybounds, fig_size=(12, 5), savefig=None, **kws)[source]#

Quick plot dendrogram using the ward clustering function from Scipy.

Parameters:
  • X – ndarray of shape (n_samples, n_features) Array of features

  • ybounds – int, integrer values to draw horizontal cluster lines that indicate the number of clusters.

  • fig_size – tuple (width, height), default =(12,5) the matplotlib figure size given as a tuple of width and height

  • kws – dict , Addditional keyword arguments passed to scipy.cluster.hierarchy.dendrogram()

Examples:
>>> from watex.datasets import fetch_data
>>> from watex.utils.plotutils import plot_naive_dendrogram
>>> X, _= fetch_data('Bagoue analysed') # data is already scaled
>>> # get the two features 'power' and  'magnitude'
>>> data = X[['power', 'magnitude']]
>>> plot_naive_dendrogram(data )
>>> # add the horizontal line of the cluster at ybounds = (20 , 20 )
>>> # for a single cluster (cluser 1)
>>> plot_naive_dendrogram(data , 20, 20 )