0

I am quite new to this blog, please excuse me if this question is not meant to this forum!

My question is, after creating a SVM model in R , I need to create a static Model out of it . What i mean to say, after this I just need to give my testset and predict the results.

I have to give this Model to the client , so they can just check the results for the test set.

example:-

#SVM Model
model<-svm(y~.,data = tr,cost =100,gamma = 1)
summary(model)
pred=fitted(model)
table(pred, y)
***********************************************************
#predicting my testdata
svm.pred <- predict(model, zz) # zz is my test set
conf.mat<-table(pred = svm.pred, true = testdata[,2])   
(accuracy<-sum(diag(conf.mat))/num_of_testdata*100)

The clients just need to run the Model and give the Testset and check the results. How can i do it in R? Any suggestions and way to solve my problem will be quite useful !

Roshan A
  • 55
  • 1
  • 6

1 Answers1

1

Give model a name you want your client to use. Then use (with the names of your choice)

save(model,file='svm.model')

That file will appear in your active directory, so you can email it/Dropbox it, etc. Then, after this, if your client has the file in their active directory, they can use

load('svm.model')

and they will now have the model in their workspace with the name you originally gave it.

Also, since you said you are new with R, you can change your directories with getwd(dirname) and setwd(dirname).

Max Candocia
  • 4,294
  • 35
  • 58
  • Thanks a lot for the answer, I also found similar answers http://stackoverflow.com/questions/5118074/reusing-a-model-built-in-r – Roshan A Dec 23 '13 at 18:39