Learn R Programming

Rtrack (version 1.0.7)

threshold_strategies: Subset an rtrack_strategies object.

Description

Subsets strategy calls based on a threshold.

Usage

threshold_strategies(strategies, threshold = NULL)

Value

An rtrack_strategies object including only above-threshold calls. In addition, the component thresholded is set to TRUE

if thresholding was performed.

Arguments

strategies

An rtrack_strategies object as generated by call_strategy.

threshold

A numeric value between 0 and 1 or a logical value depending on the strategy-calling method used (see Details).

Details

For strategy-calling algorithms yielding a confidence score (such as call_strategy), a value between 0 and 1 will return a new rtrack_strategies object only including calls with a confidence score above the given threshold. For strategy-calling algorithms that include a '0' or 'unknown' strategy, (such as call_mwm_strategy_garthe), TRUE will remove these unknown strategies while FALSE will return an unchanged rtrack_strategies object.

Examples

Run this code
require(Rtrack)
track_file <- system.file("extdata", "Track_1.csv", package = "Rtrack")
arena_description <- system.file("extdata", "Arena_SW.txt", package = "Rtrack")
arena <- read_arena(arena_description)
path <- read_path(track_file, arena, track.format = "ethovision.3.csv")
metrics <- calculate_metrics(path, arena)
strategies <- call_strategy(metrics)
# Inspect the strategy call (minimal experiment only has one track)
strategies$calls
# Thresholding at 0.4 will retain the track (confidence = 0.58)
strategies = threshold_strategies(strategies, threshold = 0.4)
strategies$calls
# Thresholding at 0.6 will discard the track, still returning an (empty) rtrack_strategies object
strategies = threshold_strategies(strategies, threshold = 0.6)
strategies$calls

Run the code above in your browser using DataLab