Splits a dataset into a left half and a right half (e.g. train / test).
Source:R/dataset-utils.R
split_dataset.RdSplits a dataset into a left half and a right half (e.g. train / test).
Arguments
- dataset
A
tf$data$Dataset, atorch$utils$data$Datasetobject, or a list of arrays with the same length.- left_size
If float (in the range
[0, 1]), it signifies the fraction of the data to pack in the left dataset. If integer, it signifies the number of samples to pack in the left dataset. IfNULL, defaults to the complement toright_size. Defaults toNULL.- right_size
If float (in the range
[0, 1]), it signifies the fraction of the data to pack in the right dataset. If integer, it signifies the number of samples to pack in the right dataset. IfNULL, defaults to the complement toleft_size. Defaults toNULL.- shuffle
Boolean, whether to shuffle the data before splitting it.
- seed
A random seed for shuffling.
Examples
data <- random_uniform(c(1000, 4))
c(left_ds, right_ds) %<-% split_dataset(list(data$numpy()), left_size = 0.8)
left_ds$cardinality()right_ds$cardinality()See also
Other dataset utils: audio_dataset_from_directory() image_dataset_from_directory() text_dataset_from_directory() timeseries_dataset_from_array()
Other utils: audio_dataset_from_directory() clear_session() config_disable_interactive_logging() config_disable_traceback_filtering() config_enable_interactive_logging() config_enable_traceback_filtering() config_is_interactive_logging_enabled() config_is_traceback_filtering_enabled() get_file() get_source_inputs() image_array_save() image_dataset_from_directory() image_from_array() image_load() image_smart_resize() image_to_array() layer_feature_space() normalize() pad_sequences() set_random_seed() text_dataset_from_directory() timeseries_dataset_from_array() to_categorical() zip_lists()