What would be a suitable loss function to solve the problem of partitioning an array into sub-arrays?

I have a long segment/array (e.g. 100000 samples) as input. Regardless of the method, I need to output a partition of this segment into $$k$$ sub-segments, which do not overlap, and whose union can but doesn't have to be the entire segment. For instance, for the segment [0, 1000], a valid output can be the list [[0, 10], [20, 50], [500, 900], [950, 970]].

I have a ground truth of the "correct" partition, for example: [[0, 15], [25, 40], [400, 650], [950, 975]]. Notice the number and length of the "truth" segments don't have to even resemble the number and length of the actual segments.

Given that I have the ground-truth, what would be a suitable loss function to solve this problem?

Currently, I don't have any special requirements from that error function, so I would just like one that makes sense, a trivial one is fine too, as I can't come up even with that.

If some error functions for such a problem exist, please let me know of them, or even what that problem is called, so I can search for something.

• It may be a good idea to explain what those "segments" are. From your tags, they may be time-series data. It may also be a good idea to explain (at a high level) what you're trying to accomplish, i.e. which problem are you really trying to solve? – nbro Nov 5 at 11:13