Skip to content

Stratified CV brakes in particular setting #61

@rachaelvp

Description

@rachaelvp

Stratified CV brakes when the number of events for some stratum is greater than V, and for others it's less than V. This is the error: Error in strata_folds[[strata]][[v]] : subscript out of bounds.

Here's an example; this fails because number of level 1 events is < V and number of level 0 events > V.

strata_ids <- c(rep(0,15), rep(1,9)) 
folds <- origami::make_folds(strata_ids = strata_ids) 

None of these examples fail:

strata_ids1 <- c(rep(0,15), rep(1,15)) # even prevalence, both levels > V 
folds1 <- origami::make_folds(strata_ids = strata_ids1)

strata_ids2 <- c(rep(0,20), rep(1,10)) # uneven prevalence, both levels > V 
folds2 <- origami::make_folds(strata_ids = strata_ids2)

strata_ids3 <- c(rep(0,5), rep(1,5)) # even prevalence, both levels < V 
folds3 <- origami::make_folds(strata_ids = strata_ids3)

strata_ids4 <- c(rep(0,8), rep(1,9)) # uneven prevalence, both levels < V 
folds4 <- origami::make_folds(strata_ids = strata_ids4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions