I've continuous distribution set of values.
For example:
0, 0.01, 0.012, 1.2, 5.33, 5.24, 5.38, 30.20, 30.21, 30.13, 30.12
I want to calculate most frequent value from this set. So I've found this question which says it's mode.
I've problem with spliting this set into clases.
I want to put in my algorithm some delta
value and assign to one class values which fullfills x - delta < mean_class_value < x + delta
. Of course I see the problem that I don't have a class and to create it I need it's mean value. Also solution which will make the same reasonable result will be ok.
Any solution in pseudocode will be great help.
My current solution its pseudocode mixed with c++ but hope understandable:
std::vector > > classes; foreach(element) { foreach(class in classes) { if(std::abs(element.value - class.first) //class first is value of class { //assign element to class here class.first = (class.first + element.value) / 2.0 //averaging class value break; } else { //create new class } } }