1
$\begingroup$

I have 10 categorical features and a multi-class target.

Training data contains rows where the same 10 categorical features may map to a different target class.

What classification algorithm should I choose that fulfils the following criteria:

  • prediction output should only show results if the prediction input matches a row example that existed in the training data. (I don't want to make assumptions on inputs it has never been trained on, as this model will deal with people's lives in the real world)
  • prediction output should be targets that match exactly the prediction input, ordered by their frequency in the training data, with the highest as 'the best match' at the top

I realize this looks like it could be 'easily' solved with databases but I would like to use Classification and train a model instead of having a cumbersome db infrastructure with columns, keys, indexes and other boring things.

$\endgroup$

1 Answer 1

1
$\begingroup$

Strictly speaking Machine Learning is not the answer to this problem imho, because a ML method always works by generalizing what is in the data. In other words ML methods are meant to make some guesses while statistically minimizing the risk of error: if you don't want any generalization or risk of error, you don't want ML.

There might be some symbolic methods which could do what you describe, but essentially it's just a very simple deterministic method:

  1. Obtain the frequency for each distinct instance (including label) in the training data in a map
  2. For each distinct instance (only features) keep the most frequent one and discard all the others.
  3. When applying, just look up the instance in the map and assign the corresponding label.

a cumbersome db infrastructure with columns, keys, indexes and other boring things.

There's a confusion here: the question of using a database or not is irrelevant here since it's a matter of how you store the data, it's just not related to using ML or not.

Usual advice: use the right tool for the right job... even if it's boring ;)

$\endgroup$
4
  • $\begingroup$ I was expecting this answer but was hoping there's some sort of hybrid deterministic + statistcal algorithm, just as we humans use in the real world. For example, a doctor applies a pure deterministic approach when triaging a patient but quickly starts augmenting it with statistics when new facts that he hasn't encountered before emerge. $\endgroup$
    – dwkd
    Commented Mar 22, 2021 at 18:59
  • $\begingroup$ @dwkd what you're describing in the comment is a two-stages method: stage 1 is deterministic and stage 2 is statistical. In the case of your problem you can indeed do something similar: 1) if the instance is known then predict the label from the training data (deterministic, as I said in the answer) 2) if the instance is unknown then predict from a model trained from the training set (in this case there might be errors, exactly like a doctor could make a mistake). Note that if the ML setting is chosen to be conservative, it can take care of both (1) and (2) because it would always predict ... $\endgroup$
    – Erwan
    Commented Mar 22, 2021 at 19:16
  • $\begingroup$ ... the right label (the most frequent) for a known instance. A simple decision tree would do that quite well for instance. $\endgroup$
    – Erwan
    Commented Mar 22, 2021 at 19:16
  • $\begingroup$ Thank you Erwan! We're having great results with XGBoost so far. $\endgroup$
    – dwkd
    Commented Mar 25, 2021 at 14:55

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.