0

I want to apply KPCA on my training data before I pass it to my SVM which seems to work fine with kernlab. Afterwards I want to embed my testing input into the new space in order to make prediction with my SVM. The documentary recommends to use the predict function, which gives me an error:

  dataTrain=as.xts(data)
  inputTrain=dataTrain[1:settings$windowTrain,1:ncol(dataTrain)-1] 
  outputTrain=dataTrain[1:settings$windowTrain,ncol(dataTrain)]
  kpcaa=kpca(x=inputTrain,data=NULL,kernel="rbfdot",kpar=list(sigma=0.01))
  inputTrain=kpcaa@pcv
  predict(object = kpcaa,newdata=inputTest)

predict(object = kpcaa,newdata=inputTest)
Error in .local(object, ...) : 
  unused argument (newdata = c(0.00065527734617099, -0.00281135973754587, 0.00121922641129046, -0.00356807890285626, 0.00140997344409755, 0.000281756282681123, 0.000657122764787132, -0.000469329337005497, -0.000187793427781635, 0.00046941746156115, -0.000751173744242273, 0.000281756282681123, 0.000187793427781635, -0.000469549710462758, 0.000751173744242273, 0.00140693171451645, -0.000937734502324261, -0.000469197212192185, 0.00112570368360299, -0.0014073277173825, 0.0014073277173825, -0.00112570368360299, 
0.000656814473530609, -0.00253580788619168, 0.00187899341266107, -0.00310223515540553, 0.00282061112162602, 0.00121979841537989, -0.00150150178359798, 0.000469461536250826, -0.00140904630893512, -0.000188022939352273, -0.000470212074305643, -0.000282233408900545, 0.00094046842255846, -0.000188022939352273, -0.000470212074305643, -0.000470433277716786, 0.00234995643227709, 0.000938438507310124, 0.000937558666089799, 0.0034613440236777, 0.00493736156014979, 0.00046453292050951

Does anybody can help me with this one? Thank you!

Deniz
  • 1

1 Answers1

0

fortunately I found that there was an error in the code.

kpcaa=kpca(x=inputTrain,data=NULL,kernel="rbfdot",kpar=list(sigma=0.01))

has to be something like...

kpcaa=kpca(~.,data=inputTrain,...)
Deniz
  • 1