Filling bins with an equal size

后端 未结 3 1518
予麋鹿
予麋鹿 2021-01-25 18:48

I have 100 groups and each group has some elements inside. For the cross validation, I want to make five bins which their size is as equal as possible.

Is there any algo

3条回答
  •  孤独总比滥情好
    2021-01-25 19:20

    This is not a cluster analysis problem (I rewrote the question to use the more appropriate wording for you). Cluster analysis is a structure discovery task.

    Instead, have a look at the following two related problems from computer science:

    • Multiprocessor scheduling seems to be what you need: given n processors, distribute the tasks such that the least time is unused
    • Bin packing problem is a classic NP-hard problem, solving the reverse problem: use as few bins of fixed size to accomodate all tasks.
    • k-Partition Problem this is probably what you want to do.

    All of these appear to be NP-hard, so you will want to use an approximation only (if you have large data, with just 5 examples you can easily brute-force all combinations)

提交回复
热议问题