I have a data frame wherein 89000 records 60% of the values are missing I am replacing the missing values by zero which is a legitimate zero which is making the data sparse. Now when I train the model with SVM for one class or novelty detection which is giving me good accuracy but I have another test datasets for_prediction1 which has 100K records and sparse when I pass the for_prediction1 to predict using the generated SVM model but it is predicting almost all of them as true which is not correct only few records should be true.

Is there any way to handle the sparse data so that it predicts the data accurately?

Can anyone help me in suggesting the pre-processing techniques that are available ?

smp_size <- floor(.9 * nrow(new_data))
train_ind <- sample(seq_len(nrow(new_data)), size = smp_size)
train <- new_data[train_ind, ]
test <- new_data[-train_ind, ]

train_features <- train[,-ncol(train)]
train_labels <- train[,ncol(train)]
test_features <- test[,-ncol(test)]
test_labels <- test[,ncol(test)]
#,gamma = .001
svm.model <- svm(train$LABELS ~ ., data = train,nu =.001
,gamma = .001,type = "one-classification"
                     ,kernel= "radial",cross =10)

Total Accuracy: 99.89021 
    Single Accuracies:
     99.9617 99.85957 99.91063 99.9234 99.87233 99.8085 99.91063 99.91063 99.91063 99.83406   

svm_pred1 <- predict(svm.model,test_features)
conf_matrix <- table(pred = svm_pred1, true = t(test_labels))
    pred       1
      FALSE   13
      TRUE  8691 

 svm_pred <- predict(svm.model,for_prediction1)

value count
 FALSE     6
 TRUE  99994
  • $\begingroup$ Choice of the correct performance metric is critical. In your case, it may be wise to optimize AUC (Area Under Curve) for example instead of classification accuracy. $\endgroup$ – Vladislavs Dovgalecs Dec 10 '17 at 3:28
  • $\begingroup$ @VladislavsDovgalecs I am implementing novelty detection for each record it says true or false. How can I implement AUC in this case? My main problem is that my data is sparse. $\endgroup$ – vinaykva Dec 10 '17 at 3:32
  • 1
    $\begingroup$ check out the Chris Manning's book on Information Retrieval (pdf is free). $\endgroup$ – Vladislavs Dovgalecs Dec 10 '17 at 5:44

Your Answer

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

Browse other questions tagged or ask your own question.