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

updated binsearch, such that investigated quarters #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AWbosman
Copy link
Collaborator

Updated binary search such that if there is an error or a timeout it wont continue with the epsilon directly next to the timeout/memout epsilon, but will search further away.
We can cite Hadar Shavits work if it gets published at AAAI

@AWbosman AWbosman added the enhancement New feature or request label Sep 12, 2024
@Aaron99B
Copy link
Collaborator

I like the idea. As we have tests for all epsilon search algorithms we should also add tests for this one in the test_epsilon_value_estimator folder

@Aaron99B
Copy link
Collaborator

Also, I think we should rename the module to make clear what exactly is adjusted compared to the binary search we have

class AdjustedBinarySearchEpsilonValueEstimator(BinarySearchEpsilonValueEstimator):


def get_next_epsilon(self, midpoint:int, first:int, last:int, epsilon_status_list: list[EpsilonStatus]) -> int:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the epsilon status list needed here?

last = midpoint - 1
midpoint = (first + last) // 2
else:
if len(epsilon_status_list)>3:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why just in case there are more than three elements in the epsilon status list?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if there are only 3, than its either last and first and midpoint, so the quartering might end up returning midpoint and then you get stuck in an endless loop. I will do this differently though

midpoint = (first + last) // 2
else:
if len(epsilon_status_list)>3:
midpoint = self.get_next_epsilon(epsilon_status_list)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The arguments do not match the function definition from above

@AWbosman
Copy link
Collaborator Author

new review required!

from tests.test_epsilon_value_estimator.conftest import MockVerificationModule


#TODO: adjust this for quartered
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this todo should still be resolved

class QuarteredBinarySearchEpsilonValueEstimator(BinarySearchEpsilonValueEstimator):


def get_next_epsilon(self, midpoint:int, first:int, last:int) -> int:
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's include spaces in the typehints

@Aaron99B
Copy link
Collaborator

Did you execute the tests with the command pytest tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants