diff --git a/pypfopt/hierarchical_portfolio.py b/pypfopt/hierarchical_portfolio.py index 52bfa177..74ff22a9 100644 --- a/pypfopt/hierarchical_portfolio.py +++ b/pypfopt/hierarchical_portfolio.py @@ -135,6 +135,7 @@ def _raw_hrp_allocation(cov, ordered_tickers): first_variance = HRPOpt._get_cluster_var(cov, first_cluster) second_variance = HRPOpt._get_cluster_var(cov, second_cluster) alpha = 1 - first_variance / (first_variance + second_variance) + w = w.astype('float64') w[first_cluster] *= alpha # weight 1 w[second_cluster] *= 1 - alpha # weight 2 return w