1
$\begingroup$

There is a two class dataset with 1121 values in total, having 230 from same class and 891 from the other class. The training set is choosen as 230+230=460 from both classes and the test set as the entire 1121 data.

1)Accuracy values are less than 0,50 even some are as low as 0,18 and 0,20. Does this make sense? For a two class outcome, there is more chance for an accurate prediction if I toss a coin. Can there be an accuracy of less than 0.50 for a two class prediction?

2)When both test-train set is choosen from the 460 class balanced rows and k-fold(1:10) is made, the accuracy levels are considerably higher, up to 0,90.

3)Can the difference between the results be because the test set is much larger than the train set?

$\endgroup$
4
  • $\begingroup$ Do the test and train set (partly) contain the same observations? $\endgroup$
    – Peter
    Commented Jan 21, 2021 at 21:58
  • $\begingroup$ Yes Peter. Test set(1121) includes the train set(460). $\endgroup$
    – Jean
    Commented Jan 22, 2021 at 20:13
  • $\begingroup$ What do you think? Can this be ok? $\endgroup$
    – Jean
    Commented Jan 22, 2021 at 20:13
  • $\begingroup$ Test set should never (!) include observations from the train set. $\endgroup$
    – Peter
    Commented Jan 22, 2021 at 20:26

1 Answer 1

0
$\begingroup$
  1. Do I correctly understand, that the test data is the whole dataset, whereas training is only a subset of it? Training and test data must not overlap. The test is a measure of quality on unseen, unfamiliar data.
  2. In the case of inbalanced data and two class classification the naive classifier, predicting always the most probable class has the quality 891 / 1121. Any sensbible model should beat this score.
  3. To handle inbalanced data you can use several approaches - undersampling the majority class, oversampling the minority https://machinelearningmastery.com/random-oversampling-and-undersampling-for-imbalanced-classification/. Also many classifiers have the attribute weights, which can be set to balanced - this would penalize larger for mistakes on minority class.
  4. In the case of imbalanced data measure not only accuracy, but precision and recall as well https://en.wikipedia.org/wiki/Precision_and_recall
$\endgroup$
3
  • $\begingroup$ Thank you for the answer. So what you are saying is the train-test data must not overlap and in case of inbalanced datasets, there are ways to handle it. What do you think of having an accuracy of less than 0.50 for a two class outcome? Does it make sense? I can toss a coin and make an accuracy of 0.50 with two outcomes. I can also invert my predictions. For example I have class a and class b as two possible outcomes and got an accuracy of 0,18. Does that mean that if I predict a result as class a, with 0,82 probability it is not class a and it is class b. Can we say that? $\endgroup$
    – Jean
    Commented Jan 22, 2021 at 20:19
  • $\begingroup$ @Jean, yes, I think you should check your implementation. Maybe your algorithm tries to optimize the opposite task, classes are permutated. $\endgroup$ Commented Jan 22, 2021 at 20:25
  • $\begingroup$ If you have any more ideas to share please do not hesitate $\endgroup$
    – Jean
    Commented Jan 22, 2021 at 20:32

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