DBHT Clustering
PortfolioOptimisers.clusterise — Method
clusterise(cle::ClustersEstimator{<:Any, <:Any, <:DBHT, <:Any}, X::MatNum;
branchorder::Symbol = :optimal, dims::Int = 1, kwargs...)Perform Direct Bubble Hierarchical Tree (DBHT) clustering using a ClustersEstimator configured with a DBHT algorithm.
This method computes the similarity and distance matrices from the input data matrix X using the estimator's configured estimators and algorithms, applies the DBHT clustering pipeline, and returns a Clusters result containing the hierarchical clustering, similarity and distance matrices, and the optimal number of clusters.
Algorithm
- Take the correlation matrix
Sand the distance matrixDfromXwithcle.ceandcle.de, throughcor_and_dist. - Check that
Dlies in the domaincle.alg.simneeds, withassert_similarity_domain. - Map
Dto the non-negative similaritySwithdistance_to_similarity, through the branchcle.alg.simselects. - Run the pipeline with
DBHTs, and keep its last output alone, theClustering.Hclustdendrogramres. - Take the number of clusters
kfromresandDwithoptimal_number_clusters, through the branchcle.oncselects. - Wrap
res,S,Dandkin aClusters.
Arguments
cle: AClustersEstimatorwhose algorithm is aDBHTinstance.X: Data matrix (observations × assetsorassets × observationsdepending ondims).branchorder: Symbol specifying the dendrogram branch ordering method. Accepts:optimal(default),:barjoseph, or:r.dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the underlying estimators.
Returns
clr::Clusters: DBHT clustering result.
Related