Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 ValueError:使用PCA.fit(python)的数学域错误_Python 2.7_Pca - Fatal编程技术网

Python 2.7 ValueError:使用PCA.fit(python)的数学域错误

Python 2.7 ValueError:使用PCA.fit(python)的数学域错误,python-2.7,pca,Python 2.7,Pca,如您所见,出现了错误: 回溯(最近一次呼叫最后一次): 文件“/Library/Python/2.7/site packages/sklearn/decomposition/pca.py”, 第86行,英寸尺寸_ (1./spectrum[uj]-1./spectrum[i])+对数(n个样本) ValueError:数学域错误 我已经知道,当我们取一个负数的对数时,会导致数学域错误,但我不明白为什么对数中会有负数? 有人能告诉我到底是什么问题吗 以下是原产地代码: pca = PCA(

如您所见,出现了错误:

回溯(最近一次呼叫最后一次):

文件“/Library/Python/2.7/site packages/sklearn/decomposition/pca.py”, 第86行,英寸尺寸_ (1./spectrum[uj]-1./spectrum[i])+对数(n个样本)

ValueError:数学域错误

我已经知道,当我们取一个负数的对数时,会导致数学域错误,但我不明白为什么对数中会有负数? 有人能告诉我到底是什么问题吗

以下是原产地代码:

    pca = PCA(n_components='mle')
    pca.fit(data)
    joblib.dump(pca, "../../conf/pca.cf")
    data = pca.transform(data)

矩阵中的元素都大于或等于0。

只是有相同的问题。结帐: