隐秘的LDA绘图错误

时间:2014-01-14 02:49:27

标签: r machine-learning

我正在尝试获取一些LDA分类器,我在一些数据上进行了训练,但是我得到了一个奇怪的错误:

> plot(CSP.reduced.LDA)
Error in terms.formula(formula, data = data) : 
  duplicated name 'CSP.1' in data frame using '.'

我不确定这是一个最小的工作示例,但我可以总结数据是什么样的:

> summary(CSP.by.trial[[subject.ind]])
     CSP.1           CSP.2           CSP.3            CSP.4       targets
 Min.   :1.206   Min.   :1.780   Min.   :0.0864   Min.   :2.714   0:140  
 1st Qu.:1.407   1st Qu.:3.398   1st Qu.:0.2300   1st Qu.:3.205   1:140  
 Median :1.470   Median :3.784   Median :0.3044   Median :3.428          
 Mean   :1.477   Mean   :3.804   Mean   :0.3247   Mean   :3.500          
 3rd Qu.:1.546   3rd Qu.:4.218   3rd Qu.:0.3986   3rd Qu.:3.723          
 Max.   :1.762   Max.   :5.454   Max.   :0.9466   Max.   :5.142


> CSP.reduced.LDA$terms
CSP.by.trial$targets ~ CSP.1 + CSP.2 + CSP.3 + CSP.4
attr(,"variables")
list(CSP.by.trial$targets, CSP.1, CSP.2, CSP.3, CSP.4)
attr(,"factors")
                     CSP.1 CSP.2 CSP.3 CSP.4
CSP.by.trial$targets     0     0     0     0
CSP.1                    1     0     0     0
CSP.2                    0     1     0     0
CSP.3                    0     0     1     0
CSP.4                    0     0     0     1
attr(,"term.labels")
[1] "CSP.1" "CSP.2" "CSP.3" "CSP.4"
attr(,"order")
[1] 1 1 1 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: R_GlobalEnv>
attr(,"predvars")
list(CSP.by.trial$targets, CSP.1, CSP.2, CSP.3, CSP.4)
attr(,"dataClasses")
CSP.by.trial$targets                CSP.1                CSP.2 
            "factor"            "numeric"            "numeric" 
               CSP.3                CSP.4 
           "numeric"            "numeric" 

1 个答案:

答案 0 :(得分:0)

等等,我知道了。它看起来像plot.lda()来自列名中.的MASS包扼流圈。用空格字符替换它们固定它。但不知道为什么它不会打破lda()开始。