individual_vec_v3 | R Documentation |
This function generates a sparse individual vector representation for evolutionary algorithms, returning a list with the indices and coefficients of non-zero elements. The values and sparsity level are based on the parameters defined in a classifier object ('clf').
individual_vec_v3(clf, signs = NULL)
clf |
A classifier object containing parameters for generating the vector, including 'size_world', 'sparsity.min', 'sparsity.max', and 'language'. |
signs |
An optional vector of signs (not used in this function but included for consistency with other versions). |
The function randomly selects a number of non-zero elements within the range specified by 'sparsity.min' and 'sparsity.max'. It then assigns values to these elements based on 'clf$params$language': for binary language, only 1s are used; for ternary language, values are -1 or 1.
A list with two elements:
A vector of indices corresponding to non-zero elements in the generated vector.
A vector of coefficients (1 or -1) at the specified indices.
## Not run:
clf <- list(params = list(language = "ternary", size_world = 50, sparsity.min = 5, sparsity.max = 15))
individual <- individual_vec_v3(clf)
print(individual)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.