Hello,

I have noticed a bug with LSSVM implementation in R. It could be a bug with
the LSSVM itself that causes this problem.

I thought I should post this message to see if anyone else is familiar with
this problem and explain why the result is different for odd and even number
of cases.

Once the hyperplane is found using LSSVM, the prediction results vary when
you predict odd or even number of samples. Why? Here I provide e.g. with
Iris data in R, keep reducing prediction cases one-by-one, you will see the
discrepancy I am talking about. In my own data, this discrepancy between odd
and even number of cases is enhanced by a huge factor.

Thanks,
Parmee

iris <- unique(iris)

rbf <- rbfdot(0.5)


lssvm> k <- kernelMatrix(rbf, as.matrix(iris[,-5]))

lssvm> klir <- lssvm(k, iris[, 5])

lssvm> pre <- predict(klir, k)


> ktest <- as.kernelMatrix(k[1:148,])

> pretest <- predict(klir, ktest)

> table(pretest,iris[1:148,5])



pretest      setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         2

  virginica       0          1        46


> ktest2 <- as.kernelMatrix(k[1:147,])

> pretest2 <- predict(klir, ktest2)

> table(pretest2,iris[1:147,5])



pretest2     setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         4

  virginica       0          1        43


> ktest3 <- as.kernelMatrix(k[1:146,])

> pretest3 <- predict(klir, ktest3)

> table(pretest3,iris[1:146,5])



pretest3     setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         2

  virginica       0          1        44


> ktest4 <- as.kernelMatrix(k[1:145,])

> pretest4 <- predict(klir, ktest4)

> table(pretest4,iris[1:145,5])


pretest4     setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         2

  virginica       0          1        43


> ktest5 <- as.kernelMatrix(k[1:144,])

> pretest5 <- predict(klir, ktest5)

> table(pretest5,iris[1:144,5])



pretest5     setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         4

  virginica       0          1        40


> ktest6 <- as.kernelMatrix(k[1:143,])

> pretest6 <- predict(klir, ktest6)

> table(pretest6,iris[1:143,5])



pretest6     setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         2

  virginica       0          1        41


> ktest7 <- as.kernelMatrix(k[1:142,])

> pretest7 <- predict(klir, ktest7)

> table(pretest7,iris[1:142,5])



pretest7     setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         2

  virginica       0          1        40


> pretest8 <- predict(klir, ktest8)

> ktest8 <- as.kernelMatrix(k[1:141,])

> table(pretest8,iris[1:141,5])



pretest8     setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         4

  virginica       0          1        37


> ktest9 <- as.kernelMatrix(k[1:140,])

> pretest9 <- predict(klir, ktest9)

> table(pretest9,iris[1:140,5])



pretest9     setosa versicolor virginica

  setosa         50          0         0

  versicolor      0         49         2

  virginica       0          1        38

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to