threshold_strategies: Subset an rtrack_strategies object.

View source: R/threshold_strategies.R

threshold_strategiesR Documentation

Subset an rtrack_strategies object.

Description

Subsets strategy calls based on a threshold.

Usage

threshold_strategies(strategies, threshold = NULL)

Arguments

strategies

An rtrack_strategies object as generated by call_strategy.

threshold

A numeric value between 0 and 1.

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.

Value

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

Examples

require(Rtrack)
track_file <- system.file("extdata", "Track_1.tab", package = "Rtrack")
arena_description <- system.file("extdata", "Arena.txt", package = "Rtrack")
arena <- read_arena(arena_description)
path <- read_path(track_file, arena, track.format = "raw.tab")
metrics <- calculate_metrics(path, arena)
strategies <- call_strategy(metrics)
# Inspect the strategy call (minimal experiment only has one track)
strategies$calls
# Thresholding at 0.7 will retain the track (confidence = 0.72)
strategies = threshold_strategies(strategies, threshold = 0.7)
strategies$calls
# Thresholding at 0.8 will discard the track, still returning an (empty) rtrack_strategies object
strategies = threshold_strategies(strategies, threshold = 0.8)
strategies$calls


Rtrack documentation built on Aug. 10, 2023, 9:10 a.m.