Skip to content

[MRG] iforest chunks for score_samples - #13283

Merged
jnothman merged 6 commits into
scikit-learn:masterfrom
ngoix:iforest_chunk
Mar 18, 2019
Merged

jnothman merged 6 commits into
scikit-learn:masterfrom
ngoix:iforest_chunk

Conversation

@ngoix

@ngoix ngoix commented Feb 26, 2019

Copy link
Copy Markdown
Contributor

fixes #12040

is currently based on top of #13260 (so do not review yet)
needs to be rebased on #13251

@agramfort

Copy link
Copy Markdown
Member

@ngoix please put the PR title to MRG when ready on your side

clf2.decision_function([[2., 2.]]))


# mock get_chunk_n_rows to actually test more than one chunk (here one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

any idea how to merge these 2 tests ? they are the same, just with a different mocked chunk size

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use pytest's monkeypatch fixture rather than unittest.mock alone?

But for this to be a reasonable test, you also need to test that the Mock has been called (or does patch do that?)

@ngoix ngoix changed the title [WIP] iforest chunks for score_samples [MRG] iforest chunks for score_samples Mar 2, 2019
@ngoix

ngoix commented Mar 4, 2019

Copy link
Copy Markdown
Contributor Author

@agramfort this is ready for reviews

@agramfort agramfort left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Update what’s new needed

@jnothman jnothman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly looking good

Comment thread sklearn/ensemble/iforest.py Outdated
" be removed in 0.22.", DeprecationWarning)
return self._threshold_

def _compute_chunked_score_samples(self, X, working_memory=None):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If not for testing, why do we need the working_melody parameter here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need the working_memory parameter here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it is not useful indeed, thanks

clf2.decision_function([[2., 2.]]))


# mock get_chunk_n_rows to actually test more than one chunk (here one

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use pytest's monkeypatch fixture rather than unittest.mock alone?

But for this to be a reasonable test, you also need to test that the Mock has been called (or does patch do that?)

@jnothman

Copy link
Copy Markdown
Member

Tests failing

@jnothman jnothman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Otherwise lgtm

Comment thread sklearn/ensemble/iforest.py Outdated
" be removed in 0.22.", DeprecationWarning)
return self._threshold_

def _compute_chunked_score_samples(self, X, working_memory=None):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need the working_memory parameter here?

Comment thread doc/whats_new/v0.21.rst Outdated
`Nicolas Goix`_.

- |Efficiency| :class:`ensemble.IsolationForest` now uses chunks of data at
prediction step. :issue:`13283` by `Nicolas Goix`_.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps say something like "capping the memory usage"

@jnothman
jnothman merged commit c22b871 into scikit-learn:master Mar 18, 2019
@jnothman

Copy link
Copy Markdown
Member

THanks @ngoix!

xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
davidgegiya added a commit to davidgegiya/agent-orchestrator that referenced this pull request Nov 9, 2026
…ge_path_length method are memory inefficient

Pin 12705bb4371c294db4461882007f40a101d74a81 and its regression selectors for reproducible runs.

Source: scikit-learn/scikit-learn#13283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Isolation forest - decision_function & average_path_length method are memory inefficient

3 participants