-
Notifications
You must be signed in to change notification settings - Fork 4
Power #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Power #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, as far as I understand it, we do not yet have a common vision of what hypotheses for power estimation should look like. But I think we will fix (with explanations) this option to start with.
@@ -0,0 +1,39 @@ | |||
from pathlib import Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add here docstring description of class, specifying tested hypotheses.
@staticmethod | ||
def __checking_near_point(container: CPContainer): | ||
"""Checks whether at least one change point is about the expected ones.""" | ||
margin = 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo it'd be better to make it a parameter.
return False | ||
|
||
for detected in detected_points: | ||
if any(expected - margin <= detected <= expected + margin for expected in expected_points): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems at least this if
can be turned into boolean return
. You can expand this further if you want, but that would probably degrade readability already. The main thing is to be careful with empty cases.
return False | ||
|
||
def calculate_power(self): | ||
"""Calculates the power of the algorithm based on hits about the disorder.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean?
time_sec=mock_data["time_sec"], | ||
) | ||
|
||
# Инициализация Power и расчет мощности |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In English
with TemporaryDirectory() as temp_dir: | ||
root_path = Path(temp_dir) | ||
|
||
# Создание mock-файлов CSV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In English
Added new Power class for calculating the statistical power of change point detection (CPD) algorithms by analyzing CSV results stored in directories. Additionally, two new methods, to_csv and from_csv, are added to the CPContainer class to enable saving and loading of CPD results in a structured CSV format.
Usage: