Pca, 特徵篩選, 歷史回測, 投資組合.
sharpe_metric = np.nan_to_num(sharpe_metric) N=5 result = pd.DataFrame({"Annual Return":annualized_ret,"Vol":annualized_vol,"Sharpe":sharpe_metric}) result.dropna(inplace=True) #Sharpe Ratio of PCA portfolio ax = result[:N]["Sharpe"].plot(linewidth=3,xticks=range(0,N,1)) ax.set_ylabel("Sharpe")