dcase_util.data.OneHotEncoder
- class dcase_util.data.OneHotEncoder(label_list=None, time_resolution=1.0, length_frames=1, length_seconds=None, allow_unknown_labels=False, **kwargs)[source]
One hot encoder class
Constructor
- Parameters
- label_listlist or str
Label list Default value None
- time_resolutionfloat
Time resolution Default value 1.0
- length_framesint
length of binary matrix in frames Default value 1
- length_secondsfloat
length of binary matrix in seconds Default value None
- allow_unknown_labelsbool
Allow unknown labels in the decoding. If False, labels not in the given label_list will produce an error. Default value False
- __init__(label_list=None, time_resolution=1.0, length_frames=1, length_seconds=None, allow_unknown_labels=False, **kwargs)[source]
Constructor
- Parameters
- label_listlist or str
Label list Default value None
- time_resolutionfloat
Time resolution Default value 1.0
- length_framesint
length of binary matrix in frames Default value 1
- length_secondsfloat
length of binary matrix in seconds Default value None
- allow_unknown_labelsbool
Allow unknown labels in the decoding. If False, labels not in the given label_list will produce an error. Default value False
Methods
__init__
([label_list, time_resolution, ...])Constructor
change_axis
([time_axis, data_axis])Set axis
delimiter
([exclude_delimiters])Use csv.sniffer to guess delimiter for CSV file
detect_file_format
([filename])Detect file format from extension
empty
()Check if file is empty
encode
(label[, length_frames, length_seconds])Generate one hot binary matrix
exists
()Checks that file exists
freeze
()Freeze focus segment, copy segment to be container's data.
get_file_information
()Get file information, filename
get_focused
()Get focus segment from data matrix.
get_frames
([frame_ids, vector_ids, frame_hop])Get frames from data matrix.
is_package
([filename])Determine if the file is compressed package.
load
([filename])Load file
log
([level])Log container content
pad
(length[, binary_matrix])Pad binary matrix along time axis
plot
([plot, binary_matrix, data_container, ...])Visualize binary matrix, and optionally synced data matrix.
push_processing_chain_item
(processor_name[, ...])Push processing chain item
reset_focus
()Reset focus segment
save
([filename])Save file
set_focus
([start, stop, duration, ...])Set focus segment
show
([mode, indent, visualize])Print container content
to_html
([indent])Get container information in a HTML formatted string
to_string
([ui, indent])Get container information in a string
validate_format
()Validate file format
Attributes
T
Transposed data in a data container
bytes
File size in bytes
data
Data matrix
focus_start
Focus segment start
focus_stop
Focus segment stop
frames
Number of data frames
length
Number of data columns
logger
Logger instance
md5
Checksum for file.
shape
Shape of data matrix
stats
Basic statistics of data matrix.
valid_formats
Valid file formats
vector_length
Data vector length