我已经使用PCA计算了我的df中所有列的分数,该df有312列和650行,代码如下:
all_pca=PCA(random_state=4)
all_pca.fit(tt)
all_pca2=all_pca.transform(tt)
plt.plot(np.cumsum(all_pca.explained_variance_ratio_) * 100)
plt.xlabel('Number of components')
plt.grid(which='both', linestyle='--', linewidth=0.5)
plt.xticks(np.arange(0, 330, step=25))
plt.yticks(np.arange(0, 110, step=10))
plt.ylabel('Explained variance (%)')
plt.savefig('elbow_plot.png', dpi=1000)
结果如下图所示.
我的主要目标是在100中只使用重要的功能.如您所见,Random forest regression, Gradient boosting, OLS regression and LASSO列描述了My Dataframe中95.2%的差异.
我可以使用这个阈值(100列)进行反向特征 Select 吗?