population2 | R Documentation |
This function generates an initial population of individuals for evolutionary algorithms, potentially using predefined parameters and sources, and evaluates their fitness.
population2(X, y, clf, featEval = NULL)
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 that includes parameters for generating and evaluating individuals. Expected to contain 'params' and possibly 'coeffs_' elements. |
featEval |
An optional named vector of feature evaluation metrics. If
|
The function initializes an evolutionary population by creating individuals based on signs, injecting predefined individuals (if specified), loading additional individuals from files, and generating new individuals with random or specific feature models. After generation, the function evaluates and sorts the population based on fitness.
A list representing the initialized and evaluated population, sorted
by fitness. Returns NULL
if the population fails to meet validity
checks.
## 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(randomSigns = FALSE, language = "bin", size_pop_random = 5, parallel.local = FALSE, in_pop = "NULL", popSourceFile = "NULL", verbose = TRUE, evolve_k1 = FALSE))
pop <- population2(X, y, clf)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.