Exemplo n.º 1
0
 def __init__(self,
              json_decoder: JSONDataBodyDecoder,
              wrapped: BaseStep,
              json_encoder: JSONDataResponseEncoder,
              route='/'):
     Pipeline.__init__(self, [json_decoder, wrapped, json_encoder])
     self.route: str = route
Exemplo n.º 2
0
    def __init__(
            self,
            pipeline: Union[BaseStep, NamedTupleList],
            validation_size: float = 0.0,
            batch_size: int = None,
            batch_metrics: Dict[str, Callable] = None,
            shuffle_in_each_epoch_at_train: bool = True,
            seed: int = None,
            n_epochs: int = 1,
            epochs_metrics: Dict[str, Callable] = None,
            scoring_function: Callable = None,
            metrics_plotting_step: BaseStep = None,
            cache_folder: str = None,
            print_epoch_metrics=False,
            print_batch_metrics=False
    ):

        if epochs_metrics is None:
            epochs_metrics = {}
        if batch_metrics is None:
            batch_metrics = {}

        self.final_scoring_metric = scoring_function
        self.epochs_metrics = epochs_metrics
        self.n_epochs = n_epochs
        self.shuffle_in_each_epoch_at_train = shuffle_in_each_epoch_at_train
        self.batch_size = batch_size
        self.batch_metrics = batch_metrics
        self.validation_size = validation_size
        self.metrics_plotting_step = metrics_plotting_step
        self.print_batch_metrics = print_batch_metrics
        self.print_epoch_metrics = print_epoch_metrics

        wrapped = pipeline
        wrapped = self._create_mini_batch_pipeline(wrapped)

        if shuffle_in_each_epoch_at_train:
            wrapped = TrainShuffled(wrapped=wrapped, seed=seed)

        wrapped = self._create_validation_split(wrapped)
        wrapped = self._create_epoch_repeater(wrapped)

        BaseStep.__init__(self)
        Pipeline.__init__(self, [wrapped], cache_folder=cache_folder)
 def __init__(self, steps: NamedTupleList):
     Pipeline.__init__(self, steps)
     self.teared_down = False
Exemplo n.º 4
0
 def __init__(self, wrapped, seed=None):
     Pipeline.__init__(self,
                       [TrainOnlyWrapper(DataShuffler(seed=seed)), wrapped])