0
$\begingroup$

I trained a model that performs classification using decision trees. I will use my model to perform classification on my dataset. My dataset also contains data that does not belong to any class in the training data. I don't want to classify them. What should I do?

training data:

features: category, product_name, brands

target variable: ingredient

category product_name brands unit ingredient
Turkish Delight pistachio flavored turkish delight koska g turkish delight
Halva, Tahini, Molasses carob molasses yeniün g molasses
Teas mint lemon tea naturali g herbal and fruit tea bags
Package Margarine classic margarine package sana g margarine
Chocolates, Bars, Wafers 1927 %60 cocoa bitter chocolate nestlé g chocolate tablet
Tea Bags for Teapot yellow label teapot tea 48-pack lipton g herbal and fruit tea bags
Fruit Juice apricot juice dimes ml fruit juice
Salt folic acid sea salt efsina g salt
Chocolate Spread, Pastes cocoa hazelnut paste sarelle g hazelnut paste
Tomato Paste tomato paste in tin carrefour g tomato paste
$\endgroup$
2
  • $\begingroup$ When you say you don't want to classify these samples, do you mean (1) you want to filter them out of your dataset before classifying your test data or (2) you want your classifier to identify that these samples don't belong to any of the possible classes? $\endgroup$
    – Lynn
    May 2, 2023 at 22:31
  • $\begingroup$ @Lynn I mean that the classifier should not include these examples in any class. (2) $\endgroup$
    – Uğur Eren
    May 3, 2023 at 12:02

1 Answer 1

1
$\begingroup$

There are two ways that I can think of.

The first way is to create a new label called "No class", then move some of the data that shouldn't be classified from your test set to your training set and label them "No class" and retrain your classifier on this extended set.

The second way is, if you can get soft classifications from your classifier (i.e. a number between 0 and 1 for each class that represents the probability or uncertainty that the example belongs to a class), then if all the soft classifications for an example are below some threshold, treat it as unclassified.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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