individual_vec_v1 | R Documentation |
This function generates an individual vector representation for evolutionary algorithms. The vector is generated with specified sparsity, based on binary or ternary language, depending on the configuration in the classifier object ('clf').
individual_vec_v1(clf, signs = NULL)
clf |
A classifier object containing parameters that guide the vector generation, including 'language', 'size_world', 'sparsity.mean', 'sparsity.min', and 'sparsity.max'. |
signs |
An optional vector of signs used to set or adjust the values in
the generated individual vector. Defaults to |
The function creates a vector of length 'clf$params$size_world', with elements initialized based on a specified probability distribution. For binary language, the vector elements are either 1 or 0, while for ternary language, they can be -1, 0, or 1. The function ensures that the vector respects specified minimum and maximum sparsity levels ('clf$params$sparsity.min' and 'clf$params$sparsity.max'), adjusting the number of non-zero elements as needed.
A numeric vector of length 'clf$params$size_world', representing an individual with the desired sparsity and language settings.
## Not run:
clf <- list(params = list(language = "ternary", size_world = 100, sparsity.mean = 0.1, sparsity.min = 5, sparsity.max = 20))
individual <- individual_vec_v1(clf)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.