def __init__(self, label_list=None, time_resolution=None, focus_field='event_label', **kwargs): """Constructor Parameters ---------- label_list : list List of labels in correct order focus_field : str Field from the meta data item to be used in encoding time_resolution : float > 0.0 Time resolution used when converting event into event roll. """ kwargs.update({ 'label_list': label_list, 'time_resolution': time_resolution, 'label': focus_field }) # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(EventRollEncodingProcessor, self).__init__(**kwargs)
def __init__(self, win_length_frames=10, hop_length_frames=1, recipe=None, **kwargs): """Constructor Parameters ---------- recipe : list of dict or list of str Aggregation recipe, supported methods [mean, std, cov, kurtosis, skew, flatten]. win_length_frames : int Window length in feature frames hop_length_frames : int Hop length in feature frames """ if recipe is None and kwargs.get('aggregation_recipe', None) is not None: recipe = kwargs.get('aggregation_recipe', None) kwargs.update({ 'win_length_frames': win_length_frames, 'hop_length_frames': hop_length_frames, 'recipe': recipe }) # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(AggregationProcessor, self).__init__(**kwargs)
def __init__(self, parameters=None, **kwargs): """Constructor Parameters ---------- parameters : dict Extraction parameters, extractor label as key and parameters as value. """ if parameters is None: parameters = {} kwargs.update( { 'parameters': parameters } ) # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(RepositoryFeatureExtractorProcessor, self).__init__(**kwargs) self.parameters = kwargs.get('parameters', {}) self.label_to_class = {} for processor in get_class_inheritors(FeatureExtractorProcessor): self.label_to_class[processor.label] = processor
def __init__(self, *args, **kwargs): """Constructor""" # Run ProcessorMixin init ProcessorMixin.__init__(self, *args, **kwargs) # Run super init to call init of mixins too super(FeatureExtractorProcessor, self).__init__(*args, **kwargs)
def __init__(self, **kwargs): """Constructor """ # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(RepositoryMaskingProcessor, self).__init__(**kwargs)
def __init__(self, n=None, s1=None, s2=None, mean=None, std=None, normalizer=None, filename=None, **kwargs): """__init__ method. Parameters ---------- n : int Item count used to calculate statistics s1 : numpy.array [shape=(vector_length,)] Vector-wise sum of the data seen by the Normalizer s2 : numpy.array [shape=(vector_length,)] Vector-wise sum^2 of the data seen by the Normalizer mean : numpy.ndarray() [shape=(vector_length, 1)] Mean of the data std : numpy.ndarray() [shape=(vector_length, 1)] Standard deviation of the data """ if filename is not None: normalizer = Normalizer().load(filename=filename) if isinstance(normalizer, Normalizer): # Valid Normalizer class given kwargs.update({ 'n': normalizer.n, 's1': normalizer.s1, 's2': normalizer.s2, 'mean': normalizer._mean, 'std': normalizer._std }) else: kwargs.update({ 'n': n, 's1': s1, 's2': s2, 'mean': mean, 'std': std }) # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(NormalizationProcessor, self).__init__(**kwargs)
def __init__(self, axis_list=None, time_axis=None, data_axis=None, sequence_axis=None, **kwargs): """Constructor Parameters ---------- axis_list : list List of axis names in order. Use this parameter or set by time_axis, data_axis, and sequence_axis. Default value None time_axis : int, optional New data axis for time. Current axis and new axis are swapped. Default value None data_axis : int, optional New data axis for data. Current axis and new axis are swapped. Default value None sequence_axis : int, optional New data axis for data sequence. Current axis and new axis are swapped. Default value None """ if axis_list is not None: if isinstance(axis_list, list): for axis_id, item in enumerate(axis_list): if 'time' in item: self.time_axis = axis_id elif 'data' in item: self.data_axis = axis_id elif 'sequence' in item: self.sequence_axis = axis_id else: message = '{name}: Wrong type for axis_list, list required.'.format( name=self.__class__.__name__) self.logger.exception(message) raise ValueError(message) else: self.time_axis = time_axis self.data_axis = data_axis self.sequence_axis = sequence_axis # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(DataShapingProcessor, self).__init__(**kwargs)
def __init__(self, *args, **kwargs): """Constructor""" # Run ProcessorMixin init ProcessorMixin.__init__(self, *args, **kwargs) # Run FeatureContainer init FeatureContainer.__init__(self, **kwargs) # Run super init to call init of mixins too super(FeatureReadingProcessor, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Constructor""" # Run ProcessorMixin init ProcessorMixin.__init__(self, *args, **kwargs) # Run MetaDataContainer init MetaDataContainer.__init__(self, **kwargs) # Run super init to call init of mixins too super(MetadataReadingProcessor, self).__init__(*args, **kwargs)
def __init__(self, data=None, fs=44100, focus_start_samples=None, focus_stop_samples=None, focus_channel=None, mono=False, **kwargs): """Constructor Parameters ---------- data : DataContainer Data to initialize the container fs : int Target sampling rate when reading audio focus_start_samples : int Sample id of the focus segment start focus_stop_samples : int Sample id of the focus segment stop focus_channel : int or str Focus segment channel mono : bool Mixdown multi-channel audio in during the reading stage. """ kwargs.update({ 'data': data, 'fs': fs, 'focus_start_samples': focus_start_samples, 'focus_stop_samples': focus_stop_samples, 'focus_channel': focus_channel, 'mono': mono }) # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run AudioContainer init AudioContainer.__init__(self, **kwargs) # Run super init to call init of mixins too super(AudioReadingProcessor, self).__init__(**kwargs) self.mono = kwargs.get('mono', False)
def __init__(self, frames=10, hop_length_frames=None, padding=None, shift_step=0, shift_border='roll', shift_max=None, **kwargs): """__init__ method. Parameters ---------- frames : int Sequence length hop_length_frames : int Hop value of when forming the sequence padding: bool Replicate data when sequence is not full shift_step : int Sequence start temporal shifting amount, is added once method increase_shifting is called shift_border : string, {'roll', 'shift'} Sequence border handling when doing temporal shifting. shift_max : int Maximum value for temporal shift """ kwargs.update({ 'frames': frames, 'hop_length_frames': hop_length_frames, 'padding': padding, 'shift_step': shift_step, 'shift_border': shift_border, 'shift_max': shift_max }) # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(SequencingProcessor, self).__init__(**kwargs)
def __init__(self, label_list=None, focus_field='tags', time_resolution=None, length_frames=None, length_seconds=None, **kwargs): """Constructor Parameters ---------- label_list : list List of labels in correct order focus_field : str Field from the meta data item to be used in encoding time_resolution : float > 0.0 Time resolution used when converting event into event roll. length_frames : int Length of encoded segment in frames length_seconds : float > 0.0 Length of encoded segment in seconds """ kwargs.update({ 'label_list': label_list, 'time_resolution': time_resolution, 'length_frames': length_frames, 'length_seconds': length_seconds, }) # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(ManyHotEncodingProcessor, self).__init__(**kwargs) self.focus_field = focus_field
def __init__(self, recipe=None, hop=1, **kwargs): """Constructor Parameters ---------- recipe : dict or str Stacking recipe hop : int, optional Feature hopping """ kwargs.update({'recipe': recipe, 'hop': hop}) # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(StackingProcessor, self).__init__(**kwargs)
def __init__(self, parameters=None, **kwargs): """__init__ method. Parameters ---------- parameters : dict Pre-calculated statistics in dict to initialize internal state """ # Run ProcessorMixin init ProcessorMixin.__init__(self, **kwargs) # Run super init to call init of mixins too super(RepositoryNormalizationProcessor, self).__init__(**kwargs) if parameters is None: parameters = {} self.parameters = parameters