<commit_before>from src import filenames
import local_pyutils

# TODO(allie): generate a static class from this file (to enable autocomplete)

default_pars = local_pyutils.dotdictify(dict(
    paths=dict(
        files=dict(
            infile_features='',
            shufflenames_libsvm='',
            shuffle_idxs='',
            runinfo_fname='',
            done_file='',
            verbose_fname=''
        ),
        folders=dict(
            path_to_tmp='',
            path_to_results='',
            predict_directories='',
            output_directory=''
        )
    ),
    algorithm=dict(
        permutations=dict(
            n_shuffles=10,
            shuffle_size=1
        ),
        discriminability=dict(
            lambd=0.1,
            alpha=1e-30,
            solver_num=0,
            window_size=100,
            window_stride_multiplier=0.5,
            window_stride=None, # Set this OR window_stride_multiplier
            max_buffer_size=-1  # -1: no max buffer size.
            ),
        aggregation=dict(
            average_over_splits='mean'
        )
    ),
    system=dict(
        anomalyframework_root='./',
        path_to_trainpredict_relative='build/src/cpp/score_shuffle',
        num_threads=8
    ),
    tags=dict(
        datestring='',
        timestring='',
        processId='',
        results_name=''
    )
))


class Pars(local_pyutils.dotdictify):
    def __init__(self, **kwargs):
        for key in default_pars:
            self.__setitem__(key, default_pars[key])
        self.set_values(**kwargs)
        filenames.fill_tags_and_paths(self)

    def set_values(self, **kwargs):
        for key, value in kwargs.items():
            local_pyutils.replace_in_nested_dictionary(self, key, value)<commit_msg>absolute path enforced for anomaly root<commit_after>import os

import local_pyutils
from src import filenames

# TODO(allie): generate a static class from this file (to enable autocomplete)

default_pars = local_pyutils.dotdictify(dict(
    paths=dict(
        files=dict(
            infile_features='',
            shufflenames_libsvm='',
            shuffle_idxs='',
            runinfo_fname='',
            done_file='',
            verbose_fname=''
        ),
        folders=dict(
            path_to_tmp='',
            path_to_results='',
            predict_directories='',
            output_directory=''
        )
    ),
    algorithm=dict(
        permutations=dict(
            n_shuffles=10,
            shuffle_size=1
        ),
        discriminability=dict(
            lambd=0.1,
            alpha=1e-30,
            solver_num=0,
            window_size=100,
            window_stride_multiplier=0.5,
            window_stride=None, # Set this OR window_stride_multiplier
            max_buffer_size=-1  # -1: no max buffer size.
            ),
        aggregation=dict(
            average_over_splits='mean'
        )
    ),
    system=dict(
        anomalyframework_root='./',
        path_to_trainpredict_relative='build/src/cpp/score_shuffle',
        num_threads=8
    ),
    tags=dict(
        datestring='',
        timestring='',
        processId='',
        results_name=''
    )
))


class Pars(local_pyutils.dotdictify):
    def __init__(self, **kwargs):
        for key in default_pars:
            self.__setitem__(key, default_pars[key])
        self.set_values(**kwargs)
        self.system.anomalyframework_root = os.path.abspath(self.system.anomalyframework_root)
        filenames.fill_tags_and_paths(self)

    def set_values(self, **kwargs):
        for key, value in kwargs.items():
            local_pyutils.replace_in_nested_dictionary(self, key, value)
{'fraction_non_alphanumeric': 0.10283687943262411, 'fraction_numerical': 0.009274413529732678, 'mean_word_length': 1.986156351791531, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4394560', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1110, 'n_words': 184}