link = link.astype(int)
// The new clusters formed
c = np.arange(link.shape[0]) + link[-1, 3]
root_id = c[-1]
d = dict(list(zip(c, link[:, 0:2].tolist())))
// Unpacks the linkage matrix recursively.
def recursive_unlink(curr, d):
Start this with curr = root integer
if curr in d:
return [
node for parent in d[curr] for node in recursive_unlink(parent, d)
]
else:
return [curr]
return recursive_unlink(root_id, d)
@staticmethod
def _raw_hrp_allocation(cov, ordered_tickers):