dcase_framework.features.FeatureNormalizer¶
-
class
dcase_framework.features.
FeatureNormalizer
(stat=None, feature_matrix=None)[source]¶ Feature normalizer
Accumulates feature statistics
Examples
>>> normalizer = FeatureNormalizer() >>> for feature_matrix in training_items: >>> normalizer.accumulate(feature_matrix) >>> >>> normalizer.finalize()
>>> for feature_matrix in test_items: >>> feature_matrix_normalized = normalizer.normalizer(feature_matrix) >>> # used the features
__init__ method.
Parameters: stat : dict or None
Pre-calculated statistics in dict to initialize internal state
feature_matrix : numpy.ndarray [shape=(frames, number of feature values)] or None
Feature matrix to be used in the initialization
-
__init__
(stat=None, feature_matrix=None)[source]¶ __init__ method.
Parameters: stat : dict or None
Pre-calculated statistics in dict to initialize internal state
feature_matrix : numpy.ndarray [shape=(frames, number of feature values)] or None
Feature matrix to be used in the initialization
Methods
__init__
([stat, feature_matrix])__init__ method. accumulate
(feature_container)Accumulate statistics clear
(() -> None. Remove all items from D.)copy
(() -> a shallow copy of D)detect_file_format
(filename)Detect file format from extension empty
()Check if file is empty exists
()Checks that file exists finalize
()Finalize statistics calculation fromkeys
(...)v defaults to None. get
((k[,d]) -> D[k] if k in D, ...)get_dump_content
(data)Clean internal content for saving get_file_information
()Get file information, filename get_hash
([data])Get unique hash string (md5) for given parameter dict get_hash_for_path
([dotted_path])get_path
(dotted_path[, default, data])Get value from nested dict with dotted path has_key
((k) -> True if D has a key k, else False)items
(() -> list of D’s (key, value) pairs, ...)iteritems
(() -> an iterator over the (key, ...)iterkeys
(() -> an iterator over the keys of D)itervalues
(...)keys
(() -> list of D’s keys)load
(\*args, \*\*kwargs)Load file log
([level])Log container content merge
(override[, target])Recursive dict merge normalize
(feature_container[, channel])Normalize feature matrix with internal statistics of the class pop
((k[,d]) -> v, ...)If key is not found, d is returned if given, otherwise KeyError is raised popitem
(() -> (k, v), ...)2-tuple; but raise KeyError if D is empty. process
(feature_data)Normalize feature matrix with internal statistics of the class save
(\*args, \*\*kwargs)Save file set_path
(dotted_path, new_value[, data])Set value in nested dict with dotted path setdefault
((k[,d]) -> D.get(k,d), ...)show
()Print container content update
(([E, ...)If E present and has a .keys() method, does: for k in E: D[k] = E[k] values
(() -> list of D’s values)viewitems
(...)viewkeys
(...)viewvalues
(...)Attributes
valid_formats
-