library(kernlab)
library(caret)
anomaly<-read.csv("D:\datasets\data\Dataset_Anomaly.csv", na.strings=c(".", "NA", "", "?"), strip.white=TRUE, encoding="UTF-8")
aRow<-nrow(anomaly)
aCol<-ncol(anomaly)sub<-sample(1:aRow,floor(0.66*aRow))
anomalyTrainingSet<- anomaly[sub,]
anomalyTestSet<- anomaly[-sub,]
anomalyClassifier<- ksvm(AttackType~.,data=anomalyTrainingSet,type = 'C-svc', kernel = 'rbfdot')
Error in if ((type(ret) == "C-svc" || type(ret) == "nu-svc" || type(ret) == :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In .local(x, ...) : Variable(s) `' constant. Cannot scale data.
2: In .local(x, ...) : NAs introduced by coercion
anomalyPrediction<-predict(anomalyClassifier, anomalyTestSet[,-aCol])
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'object' in selecting a method for function 'predict': object 'anomalyClassifier' not found
confusionMatrix(anomalyPrediction,anomalyTestSet[,aCol] )
Error: object 'anomalyPrediction' not found