Skip to content

Rename the two different ChangePoint classes for clarity#151

Closed
henrikingo wants to merge 1 commit into
masterfrom
TwoChangePointClasses
Closed

Rename the two different ChangePoint classes for clarity#151
henrikingo wants to merge 1 commit into
masterfrom
TwoChangePointClasses

Conversation

@henrikingo

Copy link
Copy Markdown
Contributor

The recent work in #96 to replace the original external dependency on the so called "signal processing" repository with our own implementation, introduced new classess ChangePoint and CandidateChangePoint, in change_point_divisive/base.py but also left in place the original ChangePoint class in analysis.py. These come together in series.py, where the newer is renamed as _ChangePoint() and also acts as a parent to older class, thus aligning their signature as much as possible.

It turns out having two similarly named classes can be a source of confusion and bugs. For example, in #141 vishnuchalla fixes a bug that is due to this and has essentially blocked the --orig-edivisive code path completely.

This patch is an effort to make the existence of two separate classes very explicit, by renaming them to ChagePointHunter and ChangePointOtava based on their "lineage".

A test case is added to exercise the --orig-edivisive code path. The test fails, as predicted by #141. The test is now cmmented out. The bug is due to a missing cp.metric property in one variation of the ChangePoint class.

Note that this patch is intended more for discussion than to merge.

Comment thread otava/series.py

@dataclass
class ChangePoint(_ChangePoint[TTestStats]):
class ChangePointHunter(ChangePointOtava[TTestStats]):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sowiks Did you have some plan what to do with these almost identical change point classes?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning to consolidate these two classes.

Comment thread pyproject.toml
@henrikingo henrikingo force-pushed the TwoChangePointClasses branch from 029b024 to c937cbb Compare May 4, 2026 14:49
The recent work in #96 to replace the original external dependency on the
so called "signal processing" repository with our own implementation,
introduced new classess ChangePoint and CandidateChangePoint, in
change_point_divisive/base.py but also left in place the original
ChangePoint class in analysis.py. These come together in series.py,
where the newer is renamed as _ChangePoint() and also acts as a parent
to older class, thus aligning their signature as much as possible.

It turns out having two similarly named classes can be a source of
confusion and bugs. For example, in #141  vishnuchalla fixes a bug
that is due to this and has essentially blocked the --orig-edivisive
code path completely.

This patch is an effort to make the existence of two separate
classes very explicit, by renaming them to ChagePointHunter
and ChangePointOtava based on their "lineage".

A test case is added to exercise the --orig-edivisive code path.
The test fails, as predicted by #141. The test is now cmmented out.
The bug is due to a missing cp.metric property in one variation
of the ChangePoint class.

Note that this patch is intended more for discussion than to merge.
@Gerrrr

Gerrrr commented May 22, 2026

Copy link
Copy Markdown
Contributor

@henrikingo CI is failing here. Can you take a look?

@henrikingo henrikingo marked this pull request as draft May 25, 2026 15:06
@henrikingo

Copy link
Copy Markdown
Contributor Author

Converting to draft. We should merge the two classes. This PR can eventually then be closed. Leaving it as draft for now.

@Gerrrr

Gerrrr commented May 27, 2026

Copy link
Copy Markdown
Contributor

@henrikingo in #154 (comment) you mentioned that this PR should be merged first. Is there anything in this work stream I need to review now? Asking just to make sure I am not stalling your progress with reviews. In general, feel free to ping me if I am dropping the ball on your PRs that are ready.

@henrikingo

Copy link
Copy Markdown
Contributor Author

No and sorry if it wasn't clear. This PR currently renames two classes to emphasize that they are separate. Based on discussion (in this thread) what we should do is to merge the two classes into one.

This is IMO not a hard dependency for #154 but would of course be nicer to do this first.

@henrikingo

Copy link
Copy Markdown
Contributor Author

Actual suggestion for refactor is now in #161
Closing this

@henrikingo henrikingo closed this May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants