错误绘制局部Fisher判别分析{lfda}包

时间:2022-05-13 23:45:21

I am running Plotting Local Fisher Discriminant Analysis ldfa {lfda} package, I use a data frame as showed below:

我正在运行Plotting Local Fisher判别分析ldfa {lfda}包,我使用的数据框如下所示:

> dim (df)
[1]  35 415

 model <- lfda(df[, 2:ncol(df)], df[, 1], r = 3, metric="plain")

I get this error:

我收到此错误:

Error in getAffinityMatrix(distance2, knn, nc) : 
  knn is too large, please try to reduce it.

knn is a parameter used in local scaling method (default: 5) I have tested lower values than 5 (4,3,2,1) but still I get another error:

knn是局部缩放方法中使用的参数(默认值:5)我测试的值低于5(4,3,2,1)但仍然出现另一个错误:

Error in solve.default(tSw) : 
system is computationally singular: reciprocal condition number = 1.90897e-24

I am not sure what is the problem and what I should do

我不确定问题是什么,我应该怎么做

1 个解决方案

#1


1  

The command lfda yields the system is computationally singular error message when one of the explanatory variables is perfectly associated to the response variable.
In the example that follows I consider the iris dataset:

当其中一个解释变量与响应变量完美关联时,命令lfda产生系统计算奇异错误消息。在下面的示例中,我考虑了虹膜数据集:

X <- iris[,-5]
y <- iris[,5]

I generate an X variable perfectly associated to y:

我生成一个与y完美关联的X变量:

X$xnew <- (iris[,5]=="virginica")

and lfda generates the error message:

和lfda生成错误消息:

result <- lfda(X, y, r=3, metric="plain")

Error in solve.default(tSw) : system is computationally singular: reciprocal condition number = 6.85339e-28

solve.default(tSw)出错:系统计算奇异:倒数条件数= 6.85339e-28

Hope this can help you to find the solution for your problem.

希望这可以帮助您找到解决问题的方法。

#1


1  

The command lfda yields the system is computationally singular error message when one of the explanatory variables is perfectly associated to the response variable.
In the example that follows I consider the iris dataset:

当其中一个解释变量与响应变量完美关联时,命令lfda产生系统计算奇异错误消息。在下面的示例中,我考虑了虹膜数据集:

X <- iris[,-5]
y <- iris[,5]

I generate an X variable perfectly associated to y:

我生成一个与y完美关联的X变量:

X$xnew <- (iris[,5]=="virginica")

and lfda generates the error message:

和lfda生成错误消息:

result <- lfda(X, y, r=3, metric="plain")

Error in solve.default(tSw) : system is computationally singular: reciprocal condition number = 6.85339e-28

solve.default(tSw)出错:系统计算奇异:倒数条件数= 6.85339e-28

Hope this can help you to find the solution for your problem.

希望这可以帮助您找到解决问题的方法。