Entering edit mode
4.3 years ago
marion.ryan
▴
50
I have a data set of normalised expression values from NanoString for two disease states. I have generated an SVM object within library(e1071), and I have no idea how to visualise it. 29 observations of 36 variables (gene expression) and two states (normal (11) and diseased 18)) -first column. Any direction here would be really valuable, I'm new to this and have adapted this code from that found on R website for e1071 package.
library(e1071)
clus2<-read.csv("PCA_NvC_SVM_2.csv", sep = ",",header = T,row.names = 1)
index<-1:nrow(clus2)
testindex<-sample(index,trunc(length(index)/3))
testset<-na.omit(clus2[testindex,-3])
trainset<-na.omit(clus2[-testindex,-3])
## smv
svm.model <- svm(Pathology ~ ., data = trainset, cost = 1000, gamma = 0.0001)
svm.pred <- predict(svm.model,testset[,-1])
cross<-crossprod(svm.pred - testset[,3]) / length(testindex)