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

Fix metric FD verifier issues #167

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

Conversation

Aviu00
Copy link
Collaborator

@Aviu00 Aviu00 commented Dec 17, 2022

Fixes floating point comparison errors when comparing values with parameter, adds a test case to cover this issue.
Fixes potential issue with access to highlight_calculator before it is created.

@github-actions
Copy link

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link

clang-tidy review says "All clean, LGTM! 👍"

src/algorithms/metric/metric_verifier.cpp Outdated Show resolved Hide resolved
Comment on lines +471 to +473
bool MetricVerifier::IsGreaterThanParameter(long double value) const {
return value > parameter_ + epsilon;
}
Copy link
Collaborator

@polyntsov polyntsov Feb 6, 2023

Choose a reason for hiding this comment

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

Вот тут сложно. Есть конкретный пример/тест, для которого сравнение нужно делать так? То есть какую конкретно проблему мы решаем

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

В cosine метрике расстояния между всеми значениями 0, но с параметром 0 зависимость не выполняется.
Я тест ещё добавил для этого случая.

Copy link
Collaborator

@polyntsov polyntsov Feb 11, 2023

Choose a reason for hiding this comment

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

но с параметром 0 зависимость не выполняется

Если параметр равен 0, то по определению метрической зависимости она не выполняется?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Если расстояния между всеми значеиниями 0, то в данном случая при любом параметре должна зависимость выполняться. Но с параметром 0 она не выполнялась. 0 <= 0 давал false

Copy link
Collaborator

Choose a reason for hiding this comment

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

То есть в сущности проблема в обычном сравнении doubleов. Не уверен, что фиксированный эпсилон это лучший способ тут, хм

Copy link
Collaborator

Choose a reason for hiding this comment

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

мб посмотреть, как с этим сражается gtest? есть EXPECT_DOUBLE_EQ, например, посмотреть, что там под капотом

https://groups.google.com/g/googletestframework/c/7ZoZWlfxpg4/m/4dHJaUbtWqAJ

@polyntsov polyntsov added the chore Performance upgrade or technical debt label Feb 6, 2023
@github-actions
Copy link

clang-tidy review says "All clean, LGTM! 👍"

@Aviu00 Aviu00 requested a review from polyntsov February 11, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Performance upgrade or technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants