I have achieved 68% accuracy with my logistic regression model. I want to increase the accuracy of the model. How can I apply stepwise regression in this code and how beneficial it would be for my model? What changes shall I make in my code to get more accuracy with my data set. I have attached my dataset below. Following is my code:

data1 <- read.csv("~/hj.csv", header=T)
train<- data1[1:116,]
testset<- data1[1:116,]
mylogit <- glm(VALUE ~ POINT1 + POINT2 + POINT3 + POINT4 , data = data1, family ="binomial")
testset$predicted.value = predict(mylogit, newdata = testset, type="response")
for (i in 1: nrow(testset)){
  if(testset$predicted.value[i] <= 0.50)
    testset$outcome[i] <- 0 
  else testset$outcome[i] <- 1
tab = table(testset$VALUE, testset$outcome) %>% as.matrix.data.frame()
accuracy = sum(diag(tab))/sum(tab)
table(testset$VALUE, testset$outcome)

enter image description here

Following is my dataset: Link 1: http://www.filedropper.com/hj_2



mylogit <- glm(VALUE ~ POINT1 * POINT2 * POINT3 * POINT4, data = data1, family ="binomial")

with about 72% accuracy.

| improve this answer | |
  • $\begingroup$ Thanks a lot. It works. What are you actually doing by multiplying the features? Is it an important step in telling us that combination of more polynomial values will increase the accuracy further? $\endgroup$ – Swordsman Feb 15 '17 at 9:45
  • $\begingroup$ @ArindamMukherjee It means all the coefficients including the interaction terms. $\endgroup$ – HelloWorld Feb 15 '17 at 11:46
  • $\begingroup$ Hi. Can you check the bottom-most part of this post. I have added my doubts there. Thanks :) $\endgroup$ – Swordsman Mar 1 '17 at 11:36
  • $\begingroup$ @ArindamMukherjee My answer already includes all interactions (the * operators). The other answer is invalid because we're talking about logistic, no need to go to random-forest. Random forest will reduce your accuracy, not improve. $\endgroup$ – HelloWorld Mar 1 '17 at 11:38
  • $\begingroup$ Okay. So what about a scenario in which I have a list of applications which should be getting classified as 1(important) in my testing set but is not doing so through the algorithm because the data doesnot back it up to get a 1(important) and it's probability is coming way beyond the threshold value. What should I do in such a situation to get it classified as 1(important)? $\endgroup$ – Swordsman Mar 1 '17 at 11:52

Try all possible combinations of interaction terms. Have you checked co-linearity of variables? Have you checked all variables interaction? Why do you stick to LR? Try Random Forest also. See what gives u best accuracy on k-fold validation.

| improve this answer | |
  • $\begingroup$ Based on my dataset, which algorithm should best work according to you? And for enhancing accuracy further, can you suggest anything? $\endgroup$ – Swordsman Feb 28 '17 at 16:32
  • $\begingroup$ compare accuracy with Random Forest. $\endgroup$ – Arpit Sisodia Mar 1 '17 at 9:00
  • $\begingroup$ Okay I ll check that. 1 more thing I want to add here about the present scenario : I have 8 applications in my training set which are being marked manually as important but I'm not able to get those apps under the Important bracket while testing because they are coming up with an importance probability of less than 40% based on the data we have gathered. $\endgroup$ – Swordsman Mar 1 '17 at 11:21
  • $\begingroup$ I want the algorithm to fit all the cases of apps which are marked as important in my training set as important, to fall under the Important bracket only keeping in mind the fact that it will increase the number of apps under the Important bracket. But how will I put these 8 apps under Important list when the data is saying otherwise? $\endgroup$ – Swordsman Mar 1 '17 at 11:21
  • $\begingroup$ Can you help in answering this? $\endgroup$ – Swordsman Mar 1 '17 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.