lucky_odds is basically a wrapper around the process: add_id --> crazyfy --> strange (weird method with set of parameters) --> singularize (default parameters: all methods) --> get_anomalies (flag top n.anom anomalies) --> fortify to enrich source data. By calling lucky_odds, analyst gets back source data with an additional column flagging some records. Though obviously simplifying the analysis process, not all options are available and intermediate objects are not available for further analysis.

lucky_odds(
  data,
  n.anom = 5,
  ...,
  analysis.drop = NULL,
  analysis.keep = NULL,
  weird = "knn",
  stack = "avg",
  stack.method = "norm"
)

Arguments

data

Source data (data.frame or data.table).

n.anom

Number of anomaly candidate records to flags.

analysis.drop

Character - set of variables to be removed from analysis (metrics computations by weird).

analysis.keep

Character - set of variables to be kept for analyis (metrics computations by weird).

stack

Stacking metric passed to get_anomalies.

stack.method

Stacking selection method passed to get_anomalies.

...

Additional parameters to be passed to weird method (analysis.method).

Selecting variables

If your source data contains variables you don't want to use in metrics computations - weird method: knnw, autoencode..., then you have to first select analysis variables. You can thos this use either analysis.keep OR analyisis.drop. Those two parameters are mutually exclusive. library(stranger) data(iris) anomalies <- lucky_odds(iris[,1:4]) table(anomalies$flag_anomaly)