get_class_weight | R Documentation |
Count number of nucleotides for each class and use as estimation for relation of class distribution.
Outputs list of class relations. Can be used as input for class_weigth
in train_model
function.
get_class_weight(
path,
vocabulary_label = NULL,
format = "fasta",
file_proportion = 1,
train_type = "label_folder",
named_list = FALSE,
csv_path = NULL
)
path |
Path to training data. If | |||||||
vocabulary_label |
Character vector of possible targets. Targets outside | |||||||
format |
File format, either | |||||||
file_proportion |
Proportion of files to randomly sample for estimating class distributions. | |||||||
train_type |
Either
| |||||||
named_list |
Whether to give class weight list names | |||||||
csv_path |
If |
A list of numeric values (class weights).
# create dummy data
path_1 <- tempfile()
path_2 <- tempfile()
for (current_path in c(path_1, path_2)) {
dir.create(current_path)
# create twice as much data for first class
num_files <- ifelse(current_path == path_1, 6, 3)
create_dummy_data(file_path = current_path,
num_files = num_files,
seq_length = 10,
num_seq = 5,
vocabulary = c("a", "c", "g", "t"))
}
class_weight <- get_class_weight(
path = c(path_1, path_2),
vocabulary_label = c("A", "B"),
format = "fasta",
file_proportion = 1,
train_type = "label_folder",
csv_path = NULL)
class_weight
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.