merge_list_of_bins: Merge list of bins

Description Usage Arguments Value Examples

View source: R/binning.R

Description

A merge function to collapse bin objects. This function is used by other functions in the binsmlr package, but it is also useful on a standalone basis when manual binning is required (enforce monotonicity across bins in terms of default rates).

Usage

1
merge_list_of_bins(list_of_bins, idx)

Arguments

list_of_bins

A list of bins.

idx

An integer (index) vector indicating which bins in list_of_bins to merge. The index vector must be sorted in ascending order without any gaps.

Value

A list of bins. Each list component in the returned list is a bin (of class bin). Total length equal to length(list_of_bins) - length(idx) + 1.

Examples

1
2
3
4
5
6
7
# example of manual binning
autobins <- autobin(bin_data, 30, "score", "default", 12, 0.01)
length(autobins)
is_monotonic(autobins, verbose = TRUE)
man_bins <- merge_list_of_bins(autobins, 3:4)
length(man_bins)
is_monotonic(man_bins)

rrunner/binsmlr documentation built on July 19, 2020, 12:41 a.m.