Skip to content

[BUG] Segmentation method to_classification and to_clustering do not work as expected #1063

@TonyBagnall

Description

@TonyBagnall

Describe the bug

these two methods in BaseSegmenter are meant to convert change points into 0/1 series where change points occur , comment says
For example change points [2, 8] for a time series of length 10
would result in: [0, 0, 1, 0, 0, 0, 0, 0, 1, 0].

but I cant see how it can be correct without being told what the length is, and output is not as expected.

the actual code is simply

        return np.bincount(change_points[1:-1], minlength=change_points[-1])

similar for to_clustering. Also not keen on the function names and they should be static methods. I think these came from clasp? @patrickzib ring any bells?

Steps/Code to reproduce the bug

calling it

import numpy as np
from aeon.segmentation import ClaSPSegmenter
bs = ClaSPSegmenter()
labels=bs.to_classification([2, 8])

Expected results

[0, 0, 1, 0, 0, 0, 0, 0, 1, 0].

Actual results

[0 0 0 0 0 0 0 0]

Versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsegmentationSegmentation package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions