This function uses likelihood encoding to map categorical variables in to a numeric value such. The beta distrubution is used as a prior (the conjugate prior of the bernoulli distribution). The parameters of the prior are taken to be alpha = n*p and beta = n*(1-p) where n is the population size and p is the population mean. New values are mapped to a random value from the Beta(alpha+a, beta+b) with a being number of successes in the group and b being number failures.
1 | betaEncoder(target, train_group, test_group, prior_strength = 1)
|
target |
target variable (default is |
group |
group variable |
seed |
random seed (default is |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.