Skip to content

Commit

Permalink
Update PlotFunctions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dcajasn committed Jul 20, 2024
1 parent a021637 commit a740617
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions riskfolio/src/PlotFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3185,6 +3185,7 @@ def plot_dendrogram(
)
else:
clustering_inds = hr.fcluster(clustering, k, criterion="maxclust")

L, M = hr.leaders(clustering, np.array(clustering_inds, dtype=np.int32))
root, nodes = hr.to_tree(clustering, rd=True)
nodes = np.array([i.dist for i in nodes])
Expand Down Expand Up @@ -3450,6 +3451,8 @@ def plot_network(
k, clustering_inds = af.std_silhouette_score(dist, clustering, max_k)
else:
raise ValueError("The only opt_k_method available are twodiff and stdsil")
else:
clustering_inds = hr.fcluster(clustering, k, criterion="maxclust")

clusters = {i: [] for i in np.unique(clustering_inds)}
for i, v in enumerate(clustering_inds):
Expand Down Expand Up @@ -4035,6 +4038,8 @@ def plot_clusters_network(
k, clustering_inds = af.std_silhouette_score(dist, clustering, max_k)
else:
raise ValueError("The only opt_k_method available are twodiff and stdsil")
else:
clustering_inds = hr.fcluster(clustering, k, criterion="maxclust")

clusters = {i: [] for i in np.unique(clustering_inds)}
for i, v in enumerate(clustering_inds):
Expand Down Expand Up @@ -4329,6 +4334,8 @@ def plot_clusters_network_allocation(
k, clustering_inds = af.std_silhouette_score(dist, clustering, max_k)
else:
raise ValueError("The only opt_k_method available are twodiff and stdsil")
else:
clustering_inds = hr.fcluster(clustering, k, criterion="maxclust")

clusters = {i: [] for i in np.unique(clustering_inds)}
for i, v in enumerate(clustering_inds):
Expand Down

0 comments on commit a740617

Please sign in to comment.