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

[OptApp] adding QNBB shape vector support #12804

Merged
merged 2 commits into from
Oct 31, 2024
Merged

Conversation

Igarizza
Copy link
Member

📝 Description
This pull request includes changes to enhance the ComputeStep method in the opt_line_search.py file. The main improvement is the addition of type checks for elements in the d array to handle both scalar and array types correctly.

🆕 Changelog

Enhancements to ComputeStep method

@Igarizza Igarizza changed the title adding QNBB shape vector support [DRAFT] adding QNBB shape vector support Oct 30, 2024
@Igarizza Igarizza changed the title [DRAFT] adding QNBB shape vector support [OptApp] adding QNBB shape vector support Oct 30, 2024
@Igarizza Igarizza requested a review from sunethwarna October 30, 2024 11:32
@Igarizza Igarizza self-assigned this Oct 30, 2024
@Igarizza Igarizza added the Bug label Oct 30, 2024
Comment on lines 159 to 165
if isinstance(d[i], (float, int, numpy.float64)):
if self.step_numpy[i] > self._max_step / norm:
self.step_numpy[i] = self._max_step / norm
elif isinstance(d[i], (numpy.ndarray)):
if self.step_numpy[i][0] > self._max_step / norm:
self.step_numpy[i] = self._max_step / norm

Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Copy link
Member Author

@Igarizza Igarizza Oct 30, 2024

Choose a reason for hiding this comment

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

if statement doesn't work with vector data correctly

Copy link
Member

@sunethwarna sunethwarna left a comment

Choose a reason for hiding this comment

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

Thanks @Igarizza . I only have minor concern.


if isinstance(d[i], (float, int, numpy.float64)) and self.step_numpy[i] > self._max_step / norm:
self.step_numpy[i] = self._max_step / norm
elif isinstance(d[i], (numpy.ndarray)) and self.step_numpy[i][0] > self._max_step / norm:
Copy link
Member

Choose a reason for hiding this comment

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

Woudn't it be better to use a norm like L2 in here instead of checking the first entry?

Copy link
Member Author

Choose a reason for hiding this comment

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

You can see, that all 3 positions have the same value, hence 1 Alfa for x y z. So, I can check the first value or check l2 norm. If we check l2 norm we need to give max step * sqrt(3) to have the same behavior.

@Igarizza Igarizza merged commit 2ae2431 into master Oct 31, 2024
11 checks passed
@Igarizza Igarizza deleted the optapp/QNBB-shape-support branch October 31, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants