Skip to content

getResamplingIndices(): Translate inner resampling indices to outer indices #2413

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 15 commits into from
Oct 4, 2018

Conversation

pat-s
Copy link
Member

@pat-s pat-s commented Aug 15, 2018

fixes #2409

So they match the task indices.

The test I added uses a basic "CV" with predefined indices (fixed = TRUE) since this resamp method groups the indices (1:30, 31:60, 61:90, etc) and the translation checking is more easy to understand.

The implementation is ofc hard to review since it uses three nested map() calls. But I think there is no other way to implement this.

The test essentially checks that in the inner inds have values that go up to the max index value of the task (in this case 150). Before, the max of inner inds was "obs - (obs/nfolds)", which evaluates to 120 in this test with 150 obs.

Can only be merged after #2412 since it uses code from this PR.

@pat-s
Copy link
Member Author

pat-s commented Aug 16, 2018

As a side not: I moved purrr from suggest to imports as we use it in various functions now.
Its not about the simple map() function but about the enhanced derivates such as imap() or pmap() that make it worth using purrr.

The type safetyness of map_int() and others can be seen as additional syntactic sugar.

pat-s added 2 commits August 16, 2018 14:34
Merge branch 'master' into getresampinds

# Conflicts:
#	DESCRIPTION
@pat-s pat-s requested a review from larskotthoff October 1, 2018 15:50
@larskotthoff
Copy link
Member

There seem to be a lot of spurious/outdated changes in this branch. Could you please check that?

@pat-s
Copy link
Member Author

pat-s commented Oct 4, 2018

have to check what's wrong in the example.

p = resample(tune_wrapper, ct, outer, show.info = FALSE,
extract = getTuneResult)

inner_inds = getResamplingIndicesNew(p, inner = TRUE)
Copy link
Member

Choose a reason for hiding this comment

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

Typo here? Tests fail.

@larskotthoff
Copy link
Member

Thanks, merging.

@larskotthoff larskotthoff merged commit 1ad87b3 into master Oct 4, 2018
@larskotthoff larskotthoff deleted the getresampinds branch October 4, 2018 14:50
vrodriguezf pushed a commit to vrodriguezf/mlr that referenced this pull request Jan 16, 2021
…ndices (mlr-org#2413)

* update getResamplingIndices()

* add explicit return statement

* add test checking translation of inner indices

* move purrr from suggests to imports and remove explicit importing notation

* no pipes

* remove duplicate fields

* fix description

* fix typo in tests

* set_names() needs to be one level higher

* update NEWS.md
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.

About inner resampling indices
2 participants