Data from CSV files
Ver. 1.1.2 (2023-04-17)
This module provides the native stream class StreamMLProCSV. This stream provides a functionality to convert csv file to a MLPro compatible stream data.
- class mlpro.bf.streams.streams.csv_file.StreamMLProCSV(p_id=None, p_name: str = '', p_num_instances: int = 0, p_version: str = '', p_feature_space: MSpace = None, p_label_space: MSpace = None, p_sampler: Sampler = None, p_mode=0, p_logging=True, **p_kwargs)
Bases:
Stream
Reusable class for converting data from csv files to MLPro’s data streams.
- Parameters:
p_id – Optional id of the stream. Default = None.
p_name (str) – Optional name of the stream. Default = ‘’.
p_num_instances (int) – Optional number of instances in the stream. Default = 0.
p_version (str) – Optional version of the stream. Default = ‘’.
p_feature_space (MSpace) – Optional feature space. Default = None.
p_label_space (MSpace) – Optional label space. Default = None.
p_sampler – Optional sampler. Default: None.
p_mode – Operation mode. Default: Mode.C_MODE_SIM.
p_logging – Log level (see constants of class Log). Default: Log.C_LOG_ALL.
p_path_load – Path of the loaded file.
p_csv_filename – File name of the loaded CSV file.
p_delimiter – Delimiter of the CSV data. Default: “ “
p_frame – Availability of framed in the loaded CSV file. Default: True
p_header – Availability of header in the first row of the loaded CSV file. Default: True
p_list_features – List of the file’s headers that is loaded as features in the stream. Default: None
p_list_labels – List of the file’s headers that is loaded as labels in the stream. Default: None
- C_ID = 'CSV2MLPro'
- C_TYPE = 'Stream CSV File'
- C_NAME = ''
- C_VERSION = '1.0.0'
- C_SCIREF_TYPE = 'Online'
- C_SCIREF_AUTHOR = 'MLPro'
- C_SCIREF_URL = 'https://mlpro.readthedocs.io'
- set_options(**p_kwargs)
Method to set specific options for the stream. The possible options depend on the stream provider and stream itself.
- _setup_feature_space() MSpace
Custom method to set up the feature space of the stream. It is called by method get_feature_space().
- Returns:
feature_space – Feature space of the stream.
- Return type:
- _setup_label_space() MSpace
Custom method to set up the label space of the stream. It is called by method get_label_space().
- Returns:
label_space – Label space of the stream.
- Return type:
- _init_dataset()
- _reset()
Custom reset method for data stream. See method __iter__() for more details.