5
$\begingroup$

Suppose I have points of two classes, distributed in 1D:

enter image description here

What is the simplest way to calculate a threshold to distinguish them?

May be just calculate two means for two classes and put threshold between them in the middle? Can I just calculate threshold in one run summing?

What is the name of this task?

$\endgroup$
0
2
$\begingroup$

The thing you are looking for are measures of impurity. The exact same problem is solved in decision trees for each feature for an arbitrary number of classes.

https://en.wikipedia.org/wiki/Decision_tree_learning#Gini_impurity

Specifically you chould have a look into gini impurity, misclassification rate and entropy. These measure can be used to identify the best threshold.

You will compute the impurity for each possible threshold (or a subset of all possible thresholds) and then chose the threshold with the lowest resulting impurity.

$\endgroup$
0
$\begingroup$

there are many metrics for this.

Otsu's https://en.wikipedia.org/wiki/Otsu%27s_method (there are implementations in sklearn)

Jenk's https://en.wikipedia.org/wiki/Jenks_natural_breaks_optimization

You can also find local minima in a KDE...

$\endgroup$

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.