class_docstr: Helper class to determine properties from datatype strings.
class_docstr_tok: ["Helper","class","to","determine","properties","from","datatype","strings","."]
docstr: Splits a list of subsets of data, where we want equal samples from each subset,
  into train/valid/test folds, ensuring that samples from a given subset are not
  changed to another fold as more subsets are added.
  
  For example, say a dataset has domains A, B. Let's say we have an experiment where we train and validate a model on domain A, then on domains A + B. If we naively concatinate the subset of data from A + B together, randomize it, and split the result into train, valid, and test folds, there is no guarantee that valid or test examples from A-only will not end up into the train fold of the A + B split from this naive concatination process.
  
  The members of these folds are randomized (but in a fixed manner) by a seed.
  
  :param fold:
     parlai fold/datatype
  :param subsets:
      List of subsets of data examples to be split
  :param train_frac:
      Fraction of data to be used for the "train" fold. train_frac, valid_frac, and test_frac should sum to 1.
  :param valid_frac:
      Fraction of data to be used for the "valid" fold. train_frac, valid_frac, and test_frac should sum to 1.
  :param test_frac:
      Fraction of data to be used for the "test" fold. train_frac, valid_frac, and test_frac should sum to 1.
  :param seed:
      Seed for shuffling
docstr_tok: ["Splits","a","list","of","subsets","of","data",",","where","we","want","equal","samples","from","each","subset",",","into","train\/valid\/test","folds",",","ensuring","that","samples","from","a","given","subset","are","not","changed","to","another","fold","as","more","subsets","are","added",".","For","example",",","say","a","dataset","has","domains","A",",","B",".","Let","'s","say","we","have","an","experiment","where","we","train","and","validate","a","model","on","domain","A",",","then","on","domains","A","+","B",".","If","we","naively","concatinate","the","subset","of","data","from","A","+","B","together",",","randomize","it",",","and","split","the","result","into","train",",","valid",",","and","test","folds",",","there","is","no","guarantee","that","valid","or","test","examples","from","A-only","will","not","end","up","into","the","train","fold","of","the","A","+","B","split","from","this","naive","concatination","process",".","The","members","of","these","folds","are","randomized","(","but","in","a","fixed","manner",")","by","a","seed",".",":","param","fold",":","parlai","fold\/datatype",":","param","subsets",":","List","of","subsets","of","data","examples","to","be","split",":","param","train_frac",":","Fraction","of","data","to","be","used","for","the","``","train","''","fold",".","train_frac",",","valid_frac",",","and","test_frac","should","sum","to","1.",":","param","valid_frac",":","Fraction","of","data","to","be","used","for","the","``","valid","''","fold",".","train_frac",",","valid_frac",",","and","test_frac","should","sum","to","1.",":","param","test_frac",":","Fraction","of","data","to","be","used","for","the","``","test","''","fold",".","train_frac",",","valid_frac",",","and","test_frac","should","sum","to","1.",":","param","seed",":","Seed","for","shuffling"]
code: def split_subset_data_by_fold(
      cls,
      fold: str,
      subsets: List[List],
      train_frac: float,
      valid_frac: float,
      test_frac: float,
      seed: int = 42,
  ):
      """
      Splits a list of subsets of data, where we want equal samples from each subset,
      into train/valid/test folds, ensuring that samples from a given subset are not
      changed to another fold as more subsets are added.
  
      For example, say a dataset has domains A, B. Let's say we have an experiment where we train and validate a model on domain A, then on domains A + B. If we naively concatinate the subset of data from A + B together, randomize it, and split the result into train, valid, and test folds, there is no guarantee that valid or test examples from A-only will not end up into the train fold of the A + B split from this naive concatination process.
  
      The members of these folds are randomized (but in a fixed manner) by a seed.
  
      :param fold:
         parlai fold/datatype
      :param subsets:
          List of subsets of data examples to be split
      :param train_frac:
          Fraction of data to be used for the "train" fold. train_frac, valid_frac, and test_frac should sum to 1.
      :param valid_frac:
          Fraction of data to be used for the "valid" fold. train_frac, valid_frac, and test_frac should sum to 1.
      :param test_frac:
          Fraction of data to be used for the "test" fold. train_frac, valid_frac, and test_frac should sum to 1.
      :param seed:
          Seed for shuffling
      """
      result = []
      for subset in subsets:
          result.extend(
              cls.split_data_by_fold(
                  fold, subset, train_frac, valid_frac, test_frac, seed
              )
          )
      random.Random(seed).shuffle(result)
      return result
  
file_path: ParlAI/parlai/utils/data.py
imports: import random
  from typing import List
label_desc: Use image node_id 8 for calling the DatatypeHelper obj's underlying member method code with example usage: obj.split_subset_data_by_fold(cls, fold, subsets, train_frac, valid_frac, test_frac, seed) and returns: result