see_if_terminate: Tests if early termination conditions are met.

View source: R/terminate.R

see_if_terminateR Documentation

Tests if early termination conditions are met.

Description

This function defines additional termination criteria which will run in addition to the max_iteration. Default is null for all values. User can specify a percentage_convergence such that when diversity falls below a specific threshold the program terminates. User can identify a estimate (from the standard summary() function that if the estimate reaches a specific threshold the program terminates or if the estimate pauses for a certain number of iterations terminates.

Usage

see_if_terminate(
  generation_matrix,
  summary_data_frame,
  estimator = NULL,
  pause_length = NULL,
  score_threshold = NULL,
  percent_converge = NULL,
  iteration,
  metric = "AIC",
  fittest = "high"
)

Arguments

generation_matrix

generation matrix with all 0s and 1s with ncol = gene_length and nrow = pop

summary_data_frame

a matrix that captures the summary() data for each generation's scores

estimator

character string referencing the named entry from summary() for instance Min.

pause_length

a numeric indicating how many iterations without improvement in the estimator before you terminate

score_threshold

a numeric indicating a threshold to cutoff if the estimator reaches that value

percent_converge

percentage of diversity when algorithm terminates for instance .1 will terminate if there are only .90 of the population is represented by the same genes

iteration

is the current iteration the main algorithm is on

metric

is the user specified statistic such as R2, AIC, BIC, or AICc

fittest

whether a custom function has the highest value corresponding to the fittest or the lowest value

Details

summary_data_frame - is imported from the main function and updated each iteration

estimator - cam be nominated from the summary() function aka Min., 1st Qu., Median, Mean, 3rd Qu., or Max.

percent_converge - terminates once diversity falls below a certain percentage. diversity is sum(unique(genes))/total_genes

Value

TRUE if terminate conditions are met with a reason, FALSE otherwise

Examples

generation_matrix <- matrix(rbinom(2*10,1,.5),ncol=10)
summary_data_frame <- data.frame(matrix(1:12,ncol=6))
names(summary_data_frame) <-c("Min.","1st Qu.","Median","Mean","3rd Qu.","Max.")
estimator <- 'Mean'
score_threshold <- 2.4
iteration <- 2

confirm_terminate <- see_if_terminate(generation_matrix,
summary_data_frame,estimator = 'Mean',
score_threshold = score_threshold, iteration = iteration)



AndrewM1130/GA documentation built on July 9, 2022, 11:43 a.m.