class_docstr: The distributor abstract base class.
  
  The main purpose of the instances of the DistributorBaseClass subclasses is to evaluate a function
  (called map_function) on a list of data items (called data).
  
  Dependent on the implementation of the distribute function, this is done in parallel or using a cluster of nodes.
class_docstr_tok: ["The","distributor","abstract","base","class",".","The","main","purpose","of","the","instances","of","the","DistributorBaseClass","subclasses","is","to","evaluate","a","function","(","called","map_function",")","on","a","list","of","data","items","(","called","data",")",".","Dependent","on","the","implementation","of","the","distribute","function",",","this","is","done","in","parallel","or","using","a","cluster","of","nodes","."]
docstr: This method contains the core functionality of the DistributorBaseClass class.
  
  It maps the map_function to each element of the data and reduces the results to return a flattened list.
  
  It needs to be implemented for each of the subclasses.
  
  :param map_function: a function to apply to each data item.
  :type map_function: callable
  :param data: the data to use in the calculation
  :type data: iterable
  :param function_kwargs: parameters for the map function
  :type function_kwargs: dict of string to parameter
  :param chunk_size: If given, chunk the data according to this size. If not given, use an empirical value.
  :type chunk_size: int
  :param data_length: If the data is a generator, you have to set the length here. If it is none, the
    length is deduced from the len of the data.
  :type data_length: int
  
  :return: the calculated results
  :rtype: list
docstr_tok: ["This","method","contains","the","core","functionality","of","the","DistributorBaseClass","class",".","It","maps","the","map_function","to","each","element","of","the","data","and","reduces","the","results","to","return","a","flattened","list",".","It","needs","to","be","implemented","for","each","of","the","subclasses",".",":","param","map_function",":","a","function","to","apply","to","each","data","item",".",":","type","map_function",":","callable",":","param","data",":","the","data","to","use","in","the","calculation",":","type","data",":","iterable",":","param","function_kwargs",":","parameters","for","the","map","function",":","type","function_kwargs",":","dict","of","string","to","parameter",":","param","chunk_size",":","If","given",",","chunk","the","data","according","to","this","size",".","If","not","given",",","use","an","empirical","value",".",":","type","chunk_size",":","int",":","param","data_length",":","If","the","data","is","a","generator",",","you","have","to","set","the","length","here",".","If","it","is","none",",","the","length","is","deduced","from","the","len","of","the","data",".",":","type","data_length",":","int",":","return",":","the","calculated","results",":","rtype",":","list"]
code: def map_reduce(
      self,
      map_function,
      data,
      function_kwargs=None,
      chunk_size=None,
      data_length=None,
  ):
      """
      This method contains the core functionality of the DistributorBaseClass class.
  
      It maps the map_function to each element of the data and reduces the results to return a flattened list.
  
      It needs to be implemented for each of the subclasses.
  
      :param map_function: a function to apply to each data item.
      :type map_function: callable
      :param data: the data to use in the calculation
      :type data: iterable
      :param function_kwargs: parameters for the map function
      :type function_kwargs: dict of string to parameter
      :param chunk_size: If given, chunk the data according to this size. If not given, use an empirical value.
      :type chunk_size: int
      :param data_length: If the data is a generator, you have to set the length here. If it is none, the
        length is deduced from the len of the data.
      :type data_length: int
  
      :return: the calculated results
      :rtype: list
      """
      raise NotImplementedError
  
imports: import itertools
  import math
  import warnings
  from collections.abc import Generator, Iterable
  from functools import partial
  from itertools import islice, repeat, takewhile
  from multiprocessing import Pool
  from tqdm import tqdm
  from tsfresh.feature_extraction.data import TsData
label_desc: Use image node_id 1 for calling the DistributorBaseClass obj's underlying member method code with example usage: obj.map_reduce(map_function, data, function_kwargs, chunk_size, data_length) without return types