<commit_before>"""
Created on 14 Oct 2016

@author: <NAME> (<EMAIL>)
"""

from decimal import Decimal

from scs_core.data.localized_datetime import LocalizedDatetime


# --------------------------------------------------------------------------------------------------------------------

class LinearRegression(object):
    """
    classdocs
    """

    MIN_DATA_POINTS =   2

    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, tally=None, time_relative=False):
        """
        Constructor
        """
        self.__tally = tally                            # number of rolling samples (None for all samples)
        self.__time_relative = time_relative            # set first timestamp to time zero

        self.__start_timestamp = None
        self.__tzinfo = None
        self.__data = []


    def __len__(self):
        return len(self.__data)


    # ----------------------------------------------------------------------------------------------------------------

    def has_midpoint(self):
        return len(self) > 0


    def has_regression(self):
        return len(self) > self.MIN_DATA_POINTS


    def append(self, rec: LocalizedDatetime, value):
        count = len(self)<commit_msg>Fixed a bug in LinearRegression.<commit_after>"""
Created on 14 Oct 2016

@author: <NAME> (<EMAIL>)
"""

from decimal import Decimal

from scs_core.data.localized_datetime import LocalizedDatetime


# --------------------------------------------------------------------------------------------------------------------

class LinearRegression(object):
    """
    classdocs
    """

    MIN_DATA_POINTS =   2

    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, tally=None, time_relative=False):
        """
        Constructor
        """
        self.__tally = tally                            # number of rolling samples (None for all samples)
        self.__time_relative = time_relative            # set first timestamp to time zero

        self.__start_timestamp = None
        self.__tzinfo = None
        self.__data = []


    def __len__(self):
        return len(self.__data)


    # ----------------------------------------------------------------------------------------------------------------

    def has_midpoint(self):
        return len(self) > 0


    def has_regression(self):
        return len(self) >= self.MIN_DATA_POINTS


    def append(self, rec: LocalizedDatetime, value):
        count = len(self)
{'fraction_non_alphanumeric': 0.3287461773700306, 'fraction_numerical': 0.0061162079510703364, 'mean_word_length': 1.031832298136646, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '4809024', 'n_tokens_mistral': 608, 'n_tokens_neox': 557, 'n_words': 145}