compute_probability_ratio {dataPreparation}R Documentation

Compute probability ratio

Description

Probability ratio is an aggregation function that can be used for build_target_encoding. Probability ratio is the P(most freq element) / (1 - P(most frq element)).

Usage

compute_probability_ratio(x)

Arguments

x

A list of categorical elements

Details

To be more generic, the library compute P(most freq element) inplace of traditional formula P(1)/P(0)

Value

P(most freq element) / (1 - P(most frq element))

Examples

# Build example list
example_list <- c(1, 1, 1, 2, 2, 3)

# Compute probability ratio
compute_probability_ratio(example_list)

[Package dataPreparation version 1.1.1 Index]