Skip to contents

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

Usage

fitness(object, ...)

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

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

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

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

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

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

Arguments

object

A segmenter object.

...

currently ignored

Value

A named double vector with the fitness value.

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

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

# Retrieve its fitness value
fitness(x)
#>     BIC 
#> 16354.7 

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

# Retrive its fitness
fitness(x)
#> MBIC 
#>    0