select: Select Individuals from a Population Using Multiple Selection...

View source: R/terga2.lib.R

selectR Documentation

Select Individuals from a Population Using Multiple Selection Methods

Description

This function selects individuals from a population using multiple selection methods specified in the classifier. It divides the selection based on specified percentages for each method, allowing a combination of selection strategies.

Usage

select(clf, pop)

Arguments

clf

A classifier object containing parameters and functions for selection, including: - 'select_perc': The percentage of the population to be selected. - 'size_pop': The total size of the population. - 'select_percByMethod': A vector of percentages defining the proportion of individuals to select by each method. - 'functions$selector': A list of selection functions to apply, corresponding to each method in 'select_percByMethod'.

pop

A list representing the population from which individuals are selected.

Details

The function calculates the number of individuals to select ('nb2BeMutated') based on 'select_perc' and the population size. It then splits the selection across methods, as defined in 'select_percByMethod'. For each method, the respective selector function (from 'clf$functions$selector') is applied to a subset of the population, excluding individuals already selected by previous methods.

The result is a list of selected individuals, combining the results of each selection method.

Value

A list of selected individuals from the population, chosen by multiple selection methods.

Examples

## Not run: 
pop <- list(
  list(fit_ = 0.9, indices_ = 1:5),
  list(fit_ = 0.8, indices_ = 6:10),
  list(fit_ = 0.7, indices_ = 11:15)
)
clf <- list(
  params = list(select_perc = 50, size_pop = 10, select_percByMethod = c(60, 40)),
  functions = list(selector = list(selector_v1, selector_v2))
)
selected_individuals <- select(clf, pop)
print(selected_individuals)

## End(Not run)


predomics/predomicspkg documentation built on Dec. 11, 2024, 11:06 a.m.