Skip to main content

split

Function split 

Source
pub fn split<P: AsRef<Path> + Sync>(
    original_benign: P,
    original_malicious: P,
    train_benign: P,
    train_malicious: P,
    test_benign: P,
    test_malicious: P,
    ratio: f32,
    validation: Option<&ValidationDirectoriesConfig>,
) -> Result<SplitErrorSummary>
Expand description

Given directories of benign and malicious files, split into four or six new directories:

  • Training benign
  • Training malicious
  • Testing benign
  • Testing malicious
  • Optional: Validation benign
  • Optional: Validation malicious

This doesn’t move or delete any files, but creates symbolic links in the target directories to the original files.

The ratio is the amount of training data to testing data, and an 80% split is ideal.

Returns a struct showing counts of errors, duplicated files, and empty files.

§Errors

Errors result if:

  • The target directories already exist and aren’t empty,
  • The target directories don’t exist and can’t be created,
  • Symbolic links can’t be created