The error is caused by the presence of missing values (NaN) in the input data. PCA does not accept missing values encoded as NaN natively. To fix this error, you can preprocess the data by either using an imputer transformer in a pipeline to fill the missing values or drop samples with missing values. Alternatively, you can use estimators that handle NaN values such as sklearn.ensemble.HistGradientBoostingClassifier and Regressor.

ValueError Traceback most recent call lastCell In45 line 14 12 # 进行PCA主元分析 13 pca = PCAn_components=2--- 14 pcafitdf_std 15 df_pca = pcatransformdf_std 1

原文地址: https://www.cveoy.top/t/topic/hhu8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录