class_docstr: Computes some statistics on marker extraction results.
  
  (1) Number of sessions where markers apply:
  
  For each marker, we compute the total number (as well as the percentage) of
  sessions in which a marker applies at least once.
  Moreover, we output the total number of sessions that were parsed.
  
  (2) Number of user turns preceding relevant events - per sessions:
  
  For each marker, we consider all relevant events where that marker applies.
  Everytime a marker applies, we check how many user turns precede that event.
  We collect all these numbers and compute basic statistics (e.g. count and mean)
  on them.
  
  This means, per session, we compute how often a marker applies and how many
  user turns precede a relevant marker application on average, in that session.
  
  (3) Number of user turns preceding relevant events - over all sessions:
  
  Here, for each marker, we consider all relevant events where a marker applies
  *in any of the sessions*. Then, we again calculate basic statistics over the
  respective number of user turns that precede each of these events.
  
  This means, we compute how many events the marker applies in total and we
  compute an estimate of the expected number of user turns preceding that
  precede an (relevant) event where a marker applies.
class_docstr_tok: ["Computes","some","statistics","on","marker","extraction","results",".","(","1",")","Number","of","sessions","where","markers","apply",":","For","each","marker",",","we","compute","the","total","number","(","as","well","as","the","percentage",")","of","sessions","in","which","a","marker","applies","at","least","once",".","Moreover",",","we","output","the","total","number","of","sessions","that","were","parsed",".","(","2",")","Number","of","user","turns","preceding","relevant","events","-","per","sessions",":","For","each","marker",",","we","consider","all","relevant","events","where","that","marker","applies",".","Everytime","a","marker","applies",",","we","check","how","many","user","turns","precede","that","event",".","We","collect","all","these","numbers","and","compute","basic","statistics","(","e.g",".","count","and","mean",")","on","them",".","This","means",",","per","session",",","we","compute","how","often","a","marker","applies","and","how","many","user","turns","precede","a","relevant","marker","application","on","average",",","in","that","session",".","(","3",")","Number","of","user","turns","preceding","relevant","events","-","over","all","sessions",":","Here",",","for","each","marker",",","we","consider","all","relevant","events","where","a","marker","applies","*","in","any","of","the","sessions","*",".","Then",",","we","again","calculate","basic","statistics","over","the","respective","number","of","user","turns","that","precede","each","of","these","events",".","This","means",",","we","compute","how","many","events","the","marker","applies","in","total","and","we","compute","an","estimate","of","the","expected","number","of","user","turns","preceding","that","precede","an","(","relevant",")","event","where","a","marker","applies","."]
code: def _write_per_session_statistics(
      self, table_writer: WriteRow
  ) -> None:
      for (
          marker_name,
          collected_statistics,
      ) in self.session_results.items():
          for statistic_name, values in collected_statistics.items():
              self._write_per_session_statistic(
                  table_writer=table_writer,
                  marker_name=marker_name,
                  statistic_name=statistic_name,
                  session_identifiers=self.session_identifier,
                  values=values,
              )
  
imports: from __future__ import annotations
  from typing import Dict, Text, Union, List, Tuple
  from rasa.utils.io import WriteRow
  from pathlib import Path
  import csv
  import numpy
  from rasa.core.evaluation.marker_base import EventMetaData
label_desc: Use image node_id 9 for calling the MarkerStatistics obj's underlying member method code with example usage: obj._write_per_session_statistics(table_writer) without return types