Skip to contents

The function subset the targeter object and retains the n top discriminant variables with regards to a criteria. It also allows filtering on minimum number of values within modality which is useful when using criteria index.max.index.

Usage

focus(
  x,
  summary_object = NULL,
  criteria = c("IV", "index.max.index", "chisquare", "pvalue", "index.max.count",
    "index.max.props"),
  n = 25,
  nmin = NULL,
  min_criteria = NULL,
  max_criteria = NULL,
  force_vars = character(),
  force_vars_groups = NULL,
  force_vars_groups_n = 1
)

Arguments

x

an object of class "targeter".

summary_object

- By default NULL. If provided, must be pre-computed summary on x callcross var object

criteria

character - sort the output according to (by default, order by decreasing index.max.index):

  • "IV" - information value.

  • "index.max.index" -value of the maximum index.

  • "chisquare" - chi-square value.

  • "pvalue" - p-value.

  • "index.max.count" - number of observations in the class associated to the maximum index.

  • "index.max.props" - proportion of the class associated to the maximum index.

n

integer - number of top variables to select. By default, n = 25.

nmin

integer - minimum number of profiles in the class. By default, 100.

min_criteria

- By default NULL. If it's specified, only the observations that have criteria >= min_criteria.

max_criteria

- By default NULL. If it's specified, only the observations that have criteria <= max_criteria. usefull to filter out suspicious variables having (too) high WoE due to high correlation with target.

force_vars

- character, list of variables that will be kept and then won't never be filtered.

force_vars_groups

- list - list of variables, for instance coming from a call of `split` on variables names (usually based on some metadata). default: NULL.

force_vars_groups_n

- integer - number of variables to be retained/forced per group? Default: 1

Value

It returns the filtered input object.

Examples

data(adult)
t <- targeter(adult, target = "ABOVE50K", analysis_name = "Analyse")
#> 
#> INFO:target ABOVE50K detected as type: binary
#> INFO:binary target contains number, automatic chosen level: 1; override using `target_reference_level`
tf <- focus(t, n = 3)
tf <- focus(t, nmin = 500, criteria = "index.max.index", min_criteria = 1.2)