class_docstr: Tracking results to a file.
  
  Also allows monitoring experiments, e.g. by
  
  .. code-block::
  
      tail -f results.txt | grep "hits_at_10"
class_docstr_tok: ["Tracking","results","to","a","file",".","Also","allows","monitoring","experiments",",","e.g",".","by","..","code-block",":",":","tail","-f","results.txt","|","grep","``","hits_at_10","''"]
docstr: Initialize the tracker.
  
  :param path:
      The path of the log file.
  :param name: The default file name for a file if no path is given. If no default is given,
      the current time is used.
docstr_tok: ["Initialize","the","tracker",".",":","param","path",":","The","path","of","the","log","file",".",":","param","name",":","The","default","file","name","for","a","file","if","no","path","is","given",".","If","no","default","is","given",",","the","current","time","is","used","."]
code: def __init__(
      self,
      path: Union[None, str, pathlib.Path] = None,
      name: Optional[str] = None,
  ):
      """Initialize the tracker.
  
      :param path:
          The path of the log file.
      :param name: The default file name for a file if no path is given. If no default is given,
          the current time is used.
      """
      if name is None:
          name = datetime.datetime.now().isoformat()
      path = normalize_path(
          path,
          default=PYKEEN_LOGS.joinpath(f"{name}.{self.extension}"),
          mkdir=True,
          is_file=True,
      )
      logger.info(f"Logging to {path.as_uri()}.")
      self.file = path.open(mode="w", newline="", encoding="utf8")
  
imports: import csv
  import datetime
  import json
  import logging
  import pathlib
  from typing import Any, ClassVar, Mapping, Optional, TextIO, Union
  from .base import ResultTracker
  from ..constants import PYKEEN_LOGS
  from ..utils import flatten_dictionary, normalize_path
label_desc: Use image node_id 1 to create a new FileResultTracker object from inherited base classes: ResultTracker with example: obj = FileResultTracker(path, name)