在PCA python skitlearn中选择k

2024-09-29 23:33:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用skitlearn软件包进行PCA。在这里给出的文档网站中 http://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html

据说,如果n_components=='mle',那么mle用于查找主成分的数量,但是当我运行我的代码时

X_reduced = PCA(n_components=mle).fit_transform(self.X)

它会给出一条错误消息

未定义全局名称“mle”

如何指定必须使用mle方法。在


Tags: 文档orgmoduleshttp网站componentssklearnscikit
1条回答
网友
1楼 · 发布于 2024-09-29 23:33:29

引用mle,就像文档中提到的那样。在

X_reduced = PCA(n_components='mle').fit_transform(self.X)

问题是当你说mle而不是mle时,它指的是变量,在你的例子中没有定义。在

相关问题 更多 >

    热门问题