docs: def map_fit(interface, state, label, inp):
      """
      Function calculates matrices ete and etde for every sample, aggregates and output them.
      """
      import numpy as np
      ete, etde = 0, 0
      out = interface.output(0)
  
      for row in inp:
          row = row.strip().split(state["delimiter"])  # split row
          if len(row) > 1:  # check if row is empty
              # intercept term is added to every sample
              x = np.array([(0 if v in state["missing_vals"] else float(v)) for i, v in enumerate(row) if
                            i in state["X_indices"]] + [-1])
              # map label value to 1 or -1. If label does not match set error
              y = 1 if state["y_map"][0] == row[state["y_index"]] else -1 if state["y_map"][1] == row[
                  state["y_index"]] else "Error"
              ete += np.outer(x, x)
              etde += x * y
      out.add("etde", etde)
      for i, row in enumerate(ete):
          out.add(i, row)