build_gabin_population {tidychangepoint}R Documentation

Initialize populations in genetic algorithms

Description

Build an initial population set for genetic algorithms

Usage

build_gabin_population(x, ...)

log_gabin_population(x, ...)

Arguments

x

a numeric vector coercible into a stats::ts object

...

arguments passed to methods

Details

Genetic algorithms require a method for randomly generating initial populations (i.e., a first generation). The default method used by GA::ga() for changepoint detection is usually GA::gabin_Population(), which selects candidate changepoints uniformly at random with probability 0.5. This leads to an initial population with excessively large candidate changepoint sets (on the order of n/2), which makes the genetic algorithm slow.

Value

A function that can be passed to the population argument of GA::ga() (through segment_ga())

See Also

GA::gabin_Population(), segment_ga()

Examples

# Build a function to generate the population
f <- build_gabin_population(CET)

# Segment the time series using the population generation function
segment(CET, method = "ga", population = f, maxiter = 5)
f <- log_gabin_population(CET)
segment(CET, method = "ga", population = f, maxiter = 10)

[Package tidychangepoint version 1.0.1 Index]