lucky_odds: Quickly apply stanger full process flow to flag candidates...

Description Usage Arguments Selecting variables

View source: R/lucky_odds.R

Description

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.

Usage

1
2
3
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.

...

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

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).

weird

weird method to use for metric computation

stack

Stacking metric passed to get_anomalies.

stack.method

Stacking selection method passed to get_anomalies.

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 analysis.drop. Those two parameters are mutually exclusive. library(stranger) data(iris) anomalies <- lucky_odds(iris[,1:4]) table(anomalies$flag_anomaly)


stranger documentation built on March 18, 2018, 2:01 p.m.