Skip to content

incorrect implementation of pdac algorithm? #4

@hadyelsahar

Description

@hadyelsahar

Hello thanks for sharing your code!

I wanted to clarify the correctness of pdac recursive implementation as currently i receive segments that are > max_segment_length.

Mostly I think the issues are in lines: #L121-L123 and #L134-L135 in the implementation that should be deleted.

    def recusrive_split(sgm):
        if sgm.duration < max_segment_length:
            segments.append(sgm)
        else:
            j = 0
            sorted_indices = np.argsort(sgm.probs)
            while j < len(sorted_indices):
                split_idx = sorted_indices[j]
                split_prob = sgm.probs[split_idx]
### this line could allow for sgm.duration > max_seglength
>                if split_prob > threshold:  
>                    segments.append(sgm)
>                    break

                sgm_a, sgm_b = split_and_trim(sgm, split_idx, threshold)
                if (
                    sgm_a.duration > min_segment_length
                    and sgm_b.duration > min_segment_length
                ):
                    recusrive_split(sgm_a)
                    recusrive_split(sgm_b)
                    break
                j += 1
### this line could allow for sgm.duration > max_seglength
>            else:
>                segments.append(sgm)

Could you please explain the need for those two clauses? , from empirical experiment and by matching with the algorithm in the paper they are not needed.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions