0
$\begingroup$

I have an array of values and I want to assign them each to two classes. I just know there are $2$ classes and I know the numbers are $6$, but I don't know the numbers beforehand. So if I have: $10, 50, 60, 11, 55, 13$, the result should be: group1: $10, 11, 13$ group2: $50, 55, 60$

How can I do this?

$\endgroup$

1 Answer 1

0
$\begingroup$

As you did not specify the objective function, it is hard to justify which grouping is better.

One interpretation of your task is that this could be a clustering problem.

A famous algorithm would be the $k$-means algorithm where we aim to minimize the within cluster sum of squares.

$\endgroup$
2
  • $\begingroup$ Is k-means also for 1D? $\endgroup$ Commented Oct 3, 2017 at 9:26
  • $\begingroup$ yup, it is applicable. $\endgroup$ Commented Oct 3, 2017 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .