<commit_before>#TODO write plotting functions.

__author__ = '<NAME>'

import traceback
from apsis.assistants.experiment_assistant import ExperimentAssistant
import matplotlib.pyplot as plt
from apsis.utilities.plot_utils import create_figure, _polish_figure, plot_lists, write_plot_to_file
from apsis.utilities.file_utils import ensure_directory_exists
import time
import datetime
import os
from apsis.utilities.logging_utils import get_logger
import numpy as np
import multiprocessing
from multiprocessing import reduction
import sys

timeout_answer = 1

ACTIONS_FOR_EXP = ["get_next_candidate", "update", "get_best_candidate",
                   "get_all_candidates"]

class LabAssistant():
    exp_assistants = None

    _write_directory_base = None
    _lab_run_directory = None
    _global_start_date = None
    _logger = None



    def __init__(self, write_directory_base="/tmp/APSIS_WRITING"):
        #TODO add check for windows for directory name in here, via os.name=="nt"
        self._logger = get_logger(self)
        self._logger.info("Initializing lab assistant.")
        self._write_directory_base = write_directory_base
        self._global_start_date = time.time()
        self._init_directory_structure() #TODO
        self.exp_assistants = {}
        self._logger.info("lab assistant successfully initialized.")

    def init_experiment(self, name, optimizer, param_defs,
                        optimizer_arguments=None, minimization=True):
        if name in self.exp_assistants:
            raise ValueError("Already an experiment with name %s registered."
                             %name)


        exp_ass = ExperimentAssistant(name, optimizer,<commit_msg>Fixed windows path import. Cleanup.<commit_after>#TODO write plotting functions.

__author__ = '<NAME>'

from apsis.assistants.experiment_assistant import ExperimentAssistant
from apsis.utilities.file_utils import ensure_directory_exists
import time
import datetime
import os
from apsis.utilities.logging_utils import get_logger


ACTIONS_FOR_EXP = ["get_next_candidate", "update", "get_best_candidate",
                   "get_all_candidates"]


class LabAssistant():
    exp_assistants = None

    _write_directory_base = None
    _lab_run_directory = None
    _global_start_date = None
    _logger = None



    def __init__(self, write_directory_base=None):
        self._logger = get_logger(self)
        if write_directory_base is None:
            if os.name == "nt":
                write_directory_base = os.path.relpath("APSIS_WRITING")
            else:
                write_directory_base = "/tmp/APSIS_WRITING"
        self._logger.info("Initializing lab assistant.")
        self._logger.info("Writing results to %s" %write_directory_base)
        self._write_directory_base = write_directory_base
        self._global_start_date = time.time()
        self._init_directory_structure()
        self.exp_assistants = {}
        self._logger.info("lab assistant successfully initialized.")

    def init_experiment(self, name, optimizer, param_defs,
                        optimizer_arguments=None, minimization=True):
        if name in self.exp_assistants:
            raise ValueError("Already an experiment with name %s registered."
                             %name)


        exp_ass = ExperimentAssistant(name, optimizer,
{'fraction_non_alphanumeric': 0.0735956743766897, 'fraction_numerical': 0.00030039050765995795, 'mean_word_length': 3.247448979591837, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1673509', 'n_tokens_mistral': 966, 'n_tokens_neox': 923, 'n_words': 224}