Skip to content
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

Implemented Moving Histogram algorithm #760

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

spran180
Copy link

@spran180 spran180 commented Jul 15, 2024

Fixes #752

Summary
This PR implemented Moving Histogram Algorithm as stated in #752. This change includes the addition of a new class 'MovHistogram' and its associated unit tests.

This comment was marked as outdated.

@spran180 spran180 marked this pull request as draft July 15, 2024 12:25
@github-actions github-actions bot added the work in progress Pull request is still in progress and changing label Jul 15, 2024
@gavv
Copy link
Member

gavv commented Jul 15, 2024

Hi, I see it's draft and haven't look at the code closely, but here a couple of preliminary comments:

  • PRs should be targeted to develop branch, not master (see here)
  • Please follow code style (see here)
  • Template classes should be defined in header, not in .cpp

@gavv gavv added the contribution A pull-request by someone else except maintainers label Jul 15, 2024
@spran180
Copy link
Author

Hi @gavv,

Thanks for reviewing my code. I will correct it shortly as per your suggestions.

@spran180 spran180 changed the base branch from master to develop July 16, 2024 08:42
@spran180 spran180 marked this pull request as ready for review July 17, 2024 15:28
@github-actions github-actions bot added ready for review Pull request can be reviewed and removed work in progress Pull request is still in progress and changing labels Jul 17, 2024
@spran180
Copy link
Author

Hello @gavv,

I have addressed the issues you highlighted. The branch has been rebased to develop, and the code has been revised to align with the coding style. Everything should be in order now. Kindly inform me if any further changes or checks are needed.

@adrianopol adrianopol self-requested a review July 19, 2024 20:13
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
Copy link
Member

@gavv gavv left a comment

Choose a reason for hiding this comment

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

Thanks for PR! A couple of comments from me as well.

src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
@gavv gavv added needs revision Pull request should be revised by its author and removed ready for review Pull request can be reviewed labels Jul 19, 2024
@spran180
Copy link
Author

Thank you for the review, @adrianopol and @gavv. I will look into it and update the code accordingly.

@spran180
Copy link
Author

spran180 commented Jul 20, 2024

Hey @adrianopol, I'm using pair<T, T> to represent the value_range {min_val, max_val} instead of creating separate variables. Is this approach correct?

@gavv
Copy link
Member

gavv commented Jul 20, 2024

Hey @adrianopol, I'm using pair<T, T> to represent the value_range {min_val, max_val} instead of creating separate variables. Is this approach correct?

We don't use STL containers, so please use separate arguments. See here: https://roc-streaming.org/toolkit/docs/development/coding_guidelines.html

@spran180
Copy link
Author

Hey @gavv / @adrianopol,

I've addressed the changes that you've requested pls go through it once and let me know if any further changes are required.

@spran180 spran180 requested a review from gavv July 22, 2024 07:38
@github-actions github-actions bot added ready for review Pull request can be reviewed and removed needs revision Pull request should be revised by its author labels Jul 22, 2024
@spran180 spran180 requested a review from adrianopol July 22, 2024 14:51
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Show resolved Hide resolved
@adrianopol adrianopol added the review in progress Pull request is being reviewed label Jul 25, 2024
@gavv gavv removed the ready for review Pull request can be reviewed label Jul 25, 2024
Copy link
Member

@adrianopol adrianopol left a comment

Choose a reason for hiding this comment

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

@spran180 , thank you for implementation.

We also need more test cases here, for example:

  • T = float
  • min and max < 0
  • win_length == 1

They may be added in a different PR if you wish.

src/tests/roc_core/test_mov_histogram.cpp Outdated Show resolved Hide resolved
src/internal_modules/roc_core/mov_histogram.h Show resolved Hide resolved
@gavv
Copy link
Member

gavv commented Jul 28, 2024

@spran180 , thank you for implementation.

We also need more test cases here, for example:

* T = float

* min and max < 0

* win_length == 1
  They may be added in a different PR if you wish.

I agree.

Also, current tests don't cover a few important aspects:

  • when there are multiple values in every bin (currently every bin is either 0 or 1)
  • how bin counters increment and decrement when rolling window is moved (e.g. you call add_value, some bin changes from N to N-1, and another bin changes from K to K+1)
  • out of bounds values (clamping)

@spran180 Let me know if you would like to add these tests or it's better to create a new issue for that.

@spran180
Copy link
Author

@spran180 , thank you for implementation.
We also need more test cases here, for example:

* T = float

* min and max < 0

* win_length == 1
  They may be added in a different PR if you wish.

I agree.

Also, current tests don't cover a few important aspects:

  • when there are multiple values in every bin (currently every bin is either 0 or 1)
  • how bin counters increment and decrement when rolling window is moved (e.g. you call add_value, some bin changes from N to N-1, and another bin changes from K to K+1)
  • out of bounds values (clamping)

@spran180 Let me know if you would like to add these tests or it's better to create a new issue for that.

Yes, I believe I should create a separate PR to add tests.

@gavv
Copy link
Member

gavv commented Jul 28, 2024

The build failure was docker hub timeout, not related to the PR. I've restarted the build and it's gone.

Yes, I believe I should create a separate PR to add tests.

@spran180 Great, do you plan to work on it, or do I create an issue for the future?

@spran180
Copy link
Author

The build failure was docker hub timeout, not related to the PR. I've restarted the build and it's gone.

Yes, I believe I should create a separate PR to add tests.

@spran180 Great, do you plan to work on it, or do I create an issue for the future?

Indeed, I am interested in working on it.

@gavv gavv added this to the next milestone Jul 28, 2024
@gavv gavv force-pushed the implement-histogram-algorithm branch from 2c93cf4 to 30e22dc Compare July 28, 2024 17:39
@gavv gavv merged commit b353852 into roc-streaming:develop Jul 28, 2024
45 checks passed
@gavv
Copy link
Member

gavv commented Jul 28, 2024

Thanks for PR!

Indeed, I am interested in working on it.

Perfect. I've copied Andrew's and mine comments here: #752 (comment)

@github-actions github-actions bot removed the review in progress Pull request is being reviewed label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution A pull-request by someone else except maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement moving histogram algorithm
3 participants