Ejemplo n.º 1
0
    def resample_batch(self, batch: DataFrame,
                       resample_config: dict) -> DataFrame:
        if not str2bool(get_recursive_config(resample_config, 'enabled')):
            return batch

        target_sampling_rate = get_recursive_config(resample_config,
                                                    'target_sampling_rate')
        method = get_recursive_config(resample_config, 'method')
        resampled_batch = batch.resample(target_sampling_rate)

        if method == 'ffill':
            return resampled_batch.ffill()
        elif method == 'bfill':
            return resampled_batch.bfill()
        elif method == 'mean':
            interpolation_method = get_recursive_config(
                resample_config, 'interpolation_method')

            return resampled_batch.mean().interpolate(
                method=interpolation_method)
        elif method == 'fill_value':
            fill_value = get_recursive_config(resample_config, 'fill_value')

            return resampled_batch.asfreq(fill_value=fill_value)
        elif method == 'interpolate':
            interpolation_method = get_recursive_config(
                resample_config, 'interpolation_method')

            return resampled_batch.interpolate(method=interpolation_method)
        else:
            return resampled_batch
Ejemplo n.º 2
0
    def __init__(self, config):
        super().__init__(config)

        self.show_columns_progress = self.get_config('show_columns_progress',
                                                     default=[])
        self.show_data_frame = str2bool(
            self.get_config('show_data_frame', default=False))
Ejemplo n.º 3
0
    def __init__(self, config):
        super().__init__(config)

        self.format = self.get_config('format', default='svg')
        self.dpi = self.get_config('dpi', default=None)
        self.show_plots = str2bool(self.get_config('show_plots', default=True))
        self.save_to_image = str2bool(self.get_config('save_to_image', default=False))
        self.save_to_pickle = str2bool(self.get_config('save_to_pickle', default=False))
        self.save_path = self.get_config('save_path', default='./out/')

        self.columns_to_plot = []
        self.accumulated_data_frame = None
        self.cli_arguments = get_cli_arguments()

        for figure_config in self.get_config('figures'):
            for plot_config in figure_config['plots']:
                self.columns_to_plot.append(plot_config['column'])
Ejemplo n.º 4
0
    def __init__(self, config: dict):
        super().__init__(config)

        self.verbose = str2bool(self.get_config('verbose', default=False))
        self.batch_size = self.get_config('batch_size', default=1)
        self.epochs = self.get_config('epochs', default=1)
        self.save_best_model = self.get_config('save_best_model', default=False)
        self.load_model = self.get_config('load_model', default=None)
        self.shuffle = self.get_config('shuffle', default=True)

        self.next_batch = []
        self.callbacks = []
        self.autoencoder = None

        if self.save_best_model:
            self.callbacks.append(ModelCheckpoint(get_current_out_path('best_model.hdf5'), save_best_only=True, monitor='loss'))
Ejemplo n.º 5
0
    def __init__(self, config: dict):
        super().__init__()

        self.config = config
        self.inverted = str2bool(self.get_config('inverted', default=False))