Learn R Programming

DALEXtra (version 1.3.2)

get_sample: Function for getting binary matrix

Description

Function creates binary matrix, to be used in aspect_importance method. It starts with a zero matrix. Then it replaces some zeros with ones. It either randomly replaces one or two zeros per row. Or replace random number of zeros per row - average number of replaced zeros can be controled by parameter f. Function doesn't allow the returned matrix to have rows with only zeros.

Usage

get_sample(n, p, sample_method = c("default", "binom"), f = 2)

Arguments

n

number of rows

p

number of columns

sample_method

sampling method

f

frequency for binomial sampling

Value

a binary matrix

Examples

Run this code
# NOT RUN {
 
# }
# NOT RUN {
 get_sample(100,6,"binom",3)
# }

Run the code above in your browser using DataLab