Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MAINT Remove _arr suffixes from _binary_tree #25106

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

Merged
merged 7 commits into from
Dec 15, 2022

Conversation

Vincent-Maladiere
Copy link
Contributor

Reference Issues/PRs

Follows up #24965
Towards #24875

What does this implement/fix? Explain your changes.

  • Remove duplicate memoryviews data_arr, sample_weight_arr, idx_array_arr, node_data_arr, and node_bounds_arr now that we convert their cnp.array counterparts to memoryviews directly.
  • Remove _update_memviews method

Any other comments?

#24965 needs to be merged first to shrink the number of changes on this PR

Copy link
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

LGTM modulo a few comments.

Comment on lines 789 to 797
# Use cinit to initialize all arrays to empty: this will prevent memory
# errors and seg-faults in rare cases where __init__ is not called
Copy link
Member

Choose a reason for hiding this comment

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

The suggestion for comments that I added previously can complete or be completed by this comment.


def __init__(self, n_pts, n_nbrs):
self.distances_arr = np.full((n_pts, n_nbrs), np.inf, dtype=DTYPE,
self.distances = np.full((n_pts, n_nbrs), np.inf, dtype=DTYPE,
order='C')
Copy link
Member

@ogrisel ogrisel Dec 6, 2022

Choose a reason for hiding this comment

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

Indentation is off. Let's use the black style for this line to avoid this kind of problems in the future.

@jjerphan jjerphan enabled auto-merge (squash) December 13, 2022 11:47
@jjerphan jjerphan disabled auto-merge December 13, 2022 11:48
@jjerphan
Copy link
Member

@ogrisel: I think this can be merged, what do you think?

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM indeed. Thanks for the PR!

@ogrisel ogrisel merged commit 205f3b7 into scikit-learn:main Dec 15, 2022
jjerphan added a commit to jjerphan/scikit-learn that referenced this pull request Jan 3, 2023

Co-authored-by: Julien Jerphanion <[email protected]>
Co-authored-by: Olivier Grisel <[email protected]>
jjerphan added a commit to jjerphan/scikit-learn that referenced this pull request Jan 20, 2023

Co-authored-by: Julien Jerphanion <[email protected]>
Co-authored-by: Olivier Grisel <[email protected]>
jjerphan added a commit to jjerphan/scikit-learn that referenced this pull request Jan 20, 2023

Co-authored-by: Julien Jerphanion <[email protected]>
Co-authored-by: Olivier Grisel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants