class_docstr: Abstract class :class:`Reporter` for result visualisation.
docstr: Initialise the base reporter with domain and metrics.
  
  Args:
      domain: A :class:`Domain` from which all evaluated samples are drawn.
      metrics: :obj:`List[str]` with names of the metrics used during
          evaluation.
      primary_metric: (optional) :obj:`str` primary metric from `metrics`.
          This is used to determine the best sample. Defaults to the first one.
      database_path: (optional) :obj:`str` path to the database for
          storing experiment history on disk. Defaults to in-memory storage.
docstr_tok: ["Initialise","the","base","reporter","with","domain","and","metrics",".","Args",":","domain",":","A",":","class",":","`","Domain","`","from","which","all","evaluated","samples","are","drawn",".","metrics",":",":","obj",":","`","List","[","str","]","`","with","names","of","the","metrics","used","during","evaluation",".","primary_metric",":","(","optional",")",":","obj",":","`","str","`","primary","metric","from","`","metrics","`",".","This","is","used","to","determine","the","best","sample",".","Defaults","to","the","first","one",".","database_path",":","(","optional",")",":","obj",":","`","str","`","path","to","the","database","for","storing","experiment","history","on","disk",".","Defaults","to","in-memory","storage","."]
code: def __init__(
      self,
      domain: Domain,
      metrics: List[str],
      primary_metric: str = "",
      database_path: str = None,
  ):
      """Initialise the base reporter with domain and metrics.
  
      Args:
          domain: A :class:`Domain` from which all evaluated samples are drawn.
          metrics: :obj:`List[str]` with names of the metrics used during
              evaluation.
          primary_metric: (optional) :obj:`str` primary metric from `metrics`.
              This is used to determine the best sample. Defaults to the first one.
          database_path: (optional) :obj:`str` path to the database for
              storing experiment history on disk. Defaults to in-memory storage.
      """
      self.domain = domain
      if not metrics:
          self.metrics = ["score"]
      else:
          self.metrics = metrics
      if not primary_metric:
          self.primary_metric = self.metrics[0]
      else:
          self.primary_metric = primary_metric
  
      self._default_table_name = (
          f"trial_{datetime.datetime.now().isoformat()}"
      )
      if database_path is not None:
          if not os.path.exists(database_path):
              os.makedirs(database_path)
          db_path = os.path.join(database_path, "db.json")
          self._db = tinydb.TinyDB(
              db_path, sort_keys=True, indent=4, separators=(",", ": ")
          )
      else:
          from tinydb.storages import MemoryStorage
  
          self._db = tinydb.TinyDB(
              storage=MemoryStorage,
              default_table=self._default_table_name,
          )
      self._db_default_table = self._db.table(self._default_table_name)
  
imports: import abc
  import datetime
  import os
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import tinydb
  from hypertunity.domain import Domain, Sample
  from hypertunity.optimisation.base import EvaluationScore, HistoryPoint
label_desc: Use image node_id 1 to create a new Reporter object  with example: obj = Reporter(domain, metrics, primary_metric, database_path)