<commit_before># !/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import operator
from collections import defaultdict
from itertools import groupby

import numpy as np
import pandas as pd

from visits_detector.core.components.data_structures import EventType, Event
from visits_detector.core.components.event_type_determiner.event_type_determiner_base import EventTypeDeterminerBase
from visits_detector.core.nn_model.model import NNModel

logging.basicConfig(level=logging.DEBUG)


def interaction_recs_2_matrix(interaction_recs):
    df = pd.DataFrame(interaction_recs)
    df.index = df['timestamp'].map(pd.datetime.utcfromtimestamp)
    df.sort_index(inplace=True)
    return df[['dist', 'speed']].resample('10S').mean().interpolate().as_matrix()


class NNEventTypeDeterminer(EventTypeDeterminerBase):
    def __init__(self, params):
        super(NNEventTypeDeterminer, self).__init__(params)
        self.params.max_definitely_short_interaction_duration = 15
        self.params.probably_continuous_interaction_rings_conf = [
            [
                (0, 30),
                (30, 60),
                (60, 70)
            ],
            [
                (0, 15),
                (15, 45),
                (45, 70)<commit_msg>Remove extra logging<commit_after># !/usr/bin/env python
# -*- coding: utf-8 -*-
import operator
from collections import defaultdict
from itertools import groupby

import numpy as np
import pandas as pd

from visits_detector.core.components.data_structures import EventType, Event
from visits_detector.core.components.event_type_determiner.event_type_determiner_base import EventTypeDeterminerBase
from visits_detector.core.nn_model.model import NNModel


def interaction_recs_2_matrix(interaction_recs):
    df = pd.DataFrame(interaction_recs)
    df.index = df['timestamp'].map(pd.datetime.utcfromtimestamp)
    df.sort_index(inplace=True)
    return df[['dist', 'speed']].resample('10S').mean().interpolate().as_matrix()


class NNEventTypeDeterminer(EventTypeDeterminerBase):
    def __init__(self, params):
        super(NNEventTypeDeterminer, self).__init__(params)
        self.params.max_definitely_short_interaction_duration = 15
        self.params.probably_continuous_interaction_rings_conf = [
            [
                (0, 30),
                (30, 60),
                (60, 70)
            ],
            [
                (0, 15),
                (15, 45),
                (45, 70)
{'fraction_non_alphanumeric': 0.09918367346938775, 'fraction_numerical': 0.022857142857142857, 'mean_word_length': 3.119327731092437, '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': '4827264', 'n_tokens_mistral': 791, 'n_tokens_neox': 713, 'n_words': 140}