evolve3m | R Documentation |
This function performs one generation of evolution on a population, including advanced mating and mutation, with optional parallel processing. It returns the evolved population after these operations.
evolve3m(X, y, clf, pop, featEval)
X |
A matrix or data frame of feature values, where each row represents a feature and each column represents a sample. |
y |
A response vector or target variable for supervised learning. The
length of |
clf |
A classifier object containing parameters for evolution, including options for mutation size, parallel processing, and debugging. |
pop |
A list representing the population, where each individual has attributes like 'mate' and 'toBeMutated'. |
featEval |
A vector or list containing feature evaluation metrics, used to guide mutation. |
The 'evolve3m' function performs an evolutionary cycle on the population with the following steps:
1. **Population Evaluation**: Each individual in the population is evaluated if not already done, and 'mate' and 'toBeMutated' attributes are initialized. 2. **Tagging for Selection and Mating**: Individuals are tagged based on selection criteria from 'clf'. 3. **Crossover and Mutation**: For individuals with mates, offspring are generated using the 'crosser' function. If an individual is marked for mutation, the 'mutator' function is applied.
The function supports parallel processing, where crossover and mutation steps are performed concurrently if 'clf$params$parallel.local' is 'TRUE'. After crossover and mutation, children and mutated individuals are combined into a new population. If 'debug' mode is enabled, messages track the evolution process.
The evolved population list, including new offspring and mutated individuals.
## Not run:
X <- matrix(rnorm(100), nrow = 10) # Random features
y <- sample(c(0, 1), 10, replace = TRUE) # Random binary response
clf <- list(params = list(
mutate_size = 10, parallel.local = FALSE, debug = TRUE
))
pop <- list(
list(fit_ = NA, indices_ = 1:5, selected = FALSE, toBeMutated = FALSE, mate = NULL),
list(fit_ = NA, indices_ = 6:10, selected = FALSE, toBeMutated = FALSE, mate = NULL)
)
featEval <- runif(10)
evolved_pop <- evolve3m(X, y, clf, pop, featEval)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.