0

I have fit a SVM linear model for one of the datasets and had run the model, every time I run the model it gives True positive and false positive values only and shows '0' False negative and true negative. Please help me what could be the possible reason for such outputs.

DESCRIPTION:

Every year thousands of applications are being submitted by international students for admission in colleges of the USA. It becomes an iterative task for the Education Department to know the total number of applications received and then compare that data with the total number of applications successfully accepted and visas processed. Hence to make the entire process easy, the education department in the US analyze the factors that influence the admission of a student into colleges. The objective of this exercise is to analyse the same. PLease note admit is the target vector.

install.packages('caret')
library('caret')
install.packages('e1071')
library('e1071')
setwd("D:/RStudio/R projects/college admission")
SVMdata=read.csv("college_admission.csv")
str(SVMdata)
summary(SVMdata)
##checking for the outliers
boxplot(SVMdata$admit)
boxplot(SVMdata$gre)

quantile(SVMdata$gre,c(0,0.02,0.03,0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,.9,0.95,0.995,0.999,1)) SVMdata1=SVMdata[SVMdata$gre>359.6, ] boxplot(SVMdata1$gre) ## we have removed the out liers in gre vector boxplot(SVMdata$gpa) quantile(SVMdata1$gpa,c(0,0.02,0.03,0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,0.995,0.999,1)) SVMdata2=SVMdata1[SVMdata1$gpa>=2.6200, ] boxplot(SVMdata2$gpa) ## we have removed the out liers in gpa vector nrow(SVMdata)-nrow(SVMdata2) SVMdata=SVMdata2 #data normalization ##creating a function for data normalization normal_data=function(x){return(x-min(x))/(max(x)-min(x))} SVMdata.n=as.data.frame(lapply(SVMdata[,1:7], normal_data)) str(SVMdata.n) ###the above data is now normalized set.seed(123) str(intrain_SVM) training=SVMdata.n[intrain_SVM, ] testing=SVMdata.n[-intrain_SVM, ] str(intrain_SVM) anyNA(SVMdata.n) #no missing values found training[["admit"]] = factor(training[["admit"]]) str(training) trctrl <- trainControl(method = "repeatedcv", number = 10, repeats=3) svm_Linar <-train(admit~.,data=training,method"svmLinear",trControl=trctrl,preProcess = c("center", "scale"),tuneLength = 10) svm_Linear test_pred <- predict(svm_Linear, newdata = testing) test_pred cm=table(test_pred, testing$admit) confusionMatrix(cm) cm

  • 1
    Without a [reproducible example](https://stackoverflow.com/q/5963269/5325862), it could be just about anything. If the question is about building and tuning a model, rather than writing and debugging the code for a model, it's better suited at [stats.se], but they'll want to see an example as well – camille Sep 10 '21 at 15:20
  • Please provide enough code so others can better understand or reproduce the problem. – Community Sep 10 '21 at 19:36
  • First a fall, Thank you for your reply and I am sorry, I thought it could be a common mistake which could be rectified by making some or the other common changes. But any ways please refer to my edited post reply my back if any thing is going wrong with the code. – MOHAMMAD SAMEER Sep 12 '21 at 14:10

0 Answers0