individual_vec_v2 | R Documentation |
This function generates an individual vector with a specific sparsity level, based on parameters defined in a classifier object ('clf'). It supports binary and ternary language configurations and allows for sign customization.
individual_vec_v2(clf, signs = NULL)
clf |
A classifier object that contains parameters for generating the vector, such as 'size_world', 'sparsity.min', 'sparsity.max', 'sparsity.mean', and 'language'. |
signs |
An optional vector of signs used to populate the individual
vector at specified indices. If |
The function constructs a vector of length 'clf$params$size_world' and assigns values based on either binary or ternary language, as specified in 'clf$params$language'. The sparsity level is controlled by 'sparsity.min' and 'sparsity.max', or by 'sparsity.mean' if the minimum and maximum sparsity levels are equal. If 'signs' is provided, it will populate the vector at selected indices.
If 'clf$params$size_world' is not set, a warning is issued (if warnings are
enabled in 'clf') and the function returns NULL
.
A numeric vector of length 'clf$params$size_world' with elements set
based on sparsity and language parameters. Returns NULL
if
'size_world' is not properly set.
## Not run:
clf <- list(params = list(language = "bin", size_world = 50, sparsity.mean = 10, sparsity.min = 5, sparsity.max = 15, warnings = TRUE))
individual <- individual_vec_v2(clf)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.