<commit_before># pylint: disable=unused-import
from typing import Dict, List, Optional, Callable, Any
# pylint: enable=unused-import

import numpy as np
import tensorflow as tf

from neuralmonkey.model.model_part import ModelPart
from neuralmonkey.runners.base_runner import (BaseRunner, Executable,
                                              ExecutionResult, NextExecute)
# pylint: disable=too-few-public-methods


class RegressionRunner(BaseRunner):

    def __init__(self,
                 output_series: str,
                 decoder: Any,
                 postprocess: Callable[[float], float]=None) -> None:
        super(RegressionRunner, self).__init__(output_series, decoder)

        self._postprocess = postprocess

    def get_executable(self,
                       compute_losses: bool=False,
                       summaries=True) -> Executable:

        if compute_losses:
            fetches = {"mse": self._decoder.cost}

        fetches["prediction"] = self._decoder.decoded_logit

        return RegressionRunExecutable(self.all_coders, fetches,
                                       self._postprocess)

    @property
    def loss_names(self) -> List[str]:
        return ["mse"]


class RegressionRunExecutable(Executable):

    def __init__(self,
                 all_coders: List[ModelPart],
                 fetches: Dict[str, tf.Tensor],
                 postprocess: Callable[[float], float]=None) -> None:
<commit_msg>bug fixed<commit_after># pylint: disable=unused-import
from typing import Dict, List, Optional, Callable, Any
# pylint: enable=unused-import

import numpy as np
import tensorflow as tf

from neuralmonkey.model.model_part import ModelPart
from neuralmonkey.runners.base_runner import (BaseRunner, Executable,
                                              ExecutionResult, NextExecute)
# pylint: disable=too-few-public-methods


class RegressionRunner(BaseRunner):

    def __init__(self,
                 output_series: str,
                 decoder: Any,
                 postprocess: Callable[[float], float]=None) -> None:
        super(RegressionRunner, self).__init__(output_series, decoder)

        self._postprocess = postprocess

    def get_executable(self,
                       compute_losses: bool=False,
                       summaries=True) -> Executable:

        if compute_losses:
            fetches = {"mse": self._decoder.cost}
        else:
            fetches = {}

        fetches["prediction"] = self._decoder.decoded_logit

        return RegressionRunExecutable(self.all_coders, fetches,
                                       self._postprocess)

    @property
    def loss_names(self) -> List[str]:
        return ["mse"]


class RegressionRunExecutable(Executable):

    def __init__(self,
                 all_coders: List[ModelPart],
                 fetches: Dict[str, tf.Tensor],
                 postprocess: Callable[[float], float]=None) -> None:

{'fraction_non_alphanumeric': 0.08932833276508695, 'fraction_numerical': 0.0, 'mean_word_length': 2.203056768558952, 'pattern_counts': {'":': 2, '<': 3, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3820285', 'n_tokens_mistral': 808, 'n_tokens_neox': 771, 'n_words': 177}