class_docstr: Class to read the datasets in DocRED format
class_docstr_tok: ["Class","to","read","the","datasets","in","DocRED","format"]
docstr: All annotated data from DocRED is splitted into train, valid and test sets in following proportions:
    len(valid_data) = len(test_data) = self.valid_test_data_size
    len(train_data) = len(all data) - 2 * self.valid_test_data_size
  Args:
      all_labeled_data: List of all annotated data samples
  Return:
      Lists of train, valid and test data
docstr_tok: ["All","annotated","data","from","DocRED","is","splitted","into","train",",","valid","and","test","sets","in","following","proportions",":","len","(","valid_data",")","=","len","(","test_data",")","=","self.valid_test_data_size","len","(","train_data",")","=","len","(","all","data",")","-","2","*","self.valid_test_data_size","Args",":","all_labeled_data",":","List","of","all","annotated","data","samples","Return",":","Lists","of","train",",","valid","and","test","data"]
code: def split_by_absolute(
      self, all_labeled_data: List
  ) -> Tuple[List, List, List]:
      """
      All annotated data from DocRED is splitted into train, valid and test sets in following proportions:
        len(valid_data) = len(test_data) = self.valid_test_data_size
        len(train_data) = len(all data) - 2 * self.valid_test_data_size
      Args:
          all_labeled_data: List of all annotated data samples
      Return:
          Lists of train, valid and test data
      """
      if (int(self.valid_test_data_size) * 3) > len(all_labeled_data):
          raise ValueError(
              f"The dataset size {len(all_labeled_data)} is too small for taking {self.valid_test_data_size} samples"
              f"for valid and test. Reduce the size of valid and test set."
          )
  
      random.shuffle(all_labeled_data)
      valid_data = all_labeled_data[: int(self.valid_test_data_size)]
      test_data = all_labeled_data[
          int(self.valid_test_data_size)
          + 1 : 2 * int(self.valid_test_data_size)
      ]
      train_data = all_labeled_data[
          2 * int(self.valid_test_data_size) + 1 :
      ]
      return train_data, valid_data, test_data
  
imports: import itertools
  import json
  import os
  import random
  from logging import getLogger
  from pathlib import Path
  from typing import Dict, List, Tuple, Union
  import numpy
  import pandas
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.dataset_reader import DatasetReader
label_desc: Use image node_id 2 for calling the DocREDDatasetReader obj's underlying member method code with example usage: obj.split_by_absolute(all_labeled_data) and returns: train_data,  valid_data,  test_data