Learn R Programming

tidychangepoint (version 1.0.1)

fitness: Retrieve the optimal fitness (or objective function) value used by an algorithm

Description

Retrieve the optimal fitness (or objective function) value used by an algorithm

Usage

fitness(object, ...)

# S3 method for seg_basket fitness(object, ...)

# S3 method for seg_cpt fitness(object, ...)

# S3 method for tidycpt fitness(object, ...)

# S3 method for ga fitness(object, ...)

# S3 method for cpt fitness(object, ...)

# S3 method for cga fitness(object, ...)

# S3 method for segmented fitness(object, ...)

# S3 method for wbs fitness(object, ...)

Value

A named double vector with the fitness value.

Arguments

object

A segmenter object.

...

currently ignored

Details

Segmenting algorithms use a fitness metric, typically through the use of a penalized objective function, to determine which changepoint sets are more or less optimal. This function returns the value of that metric for the changepoint set implied by the object provided.

See Also

Other tidycpt-generics: as.model(), as.segmenter(), changepoints(), diagnose(), model_name()

Other segmenter-functions: as.segmenter(), model_args(), seg_params()

Examples

Run this code
# Segment a times series using a genetic algorithm
x <- segment(DataCPSim, method = "ga", maxiter = 10)

# Retrieve its fitness value
fitness(x)

# \donttest{
# Segment a times series using a genetic algorithm
x <- segment(DataCPSim, method = "cga")

# Retrieve its fitness value
fitness(x)
# }
# Segment a time series using Segmented
x <- segment(DataCPSim, method = "segmented")

# Retrieve its fitness
fitness(x)

# Segment a time series using Wild Binary Segmentation
x <- segment(DataCPSim, method = "wbs")

# Retrieve its fitness
fitness(x)

Run the code above in your browser using DataLab