hibou.data_preprocessing.split_from_file#
- hibou.preprocessing.split_from_file(inputs: DataFrame, targets: DataFrame, timestamps: DataFrame, file: str, date_format: str, train_first: bool = True)#
Splits the inputs and targets data with given dates.
Parameters#
- inputs
pd.DataFrame The inputs data to be split.
- targets
pd.DataFrame The targets data to be split.
- timestamps
pd.DataFrame The timestamps data to be split.
timestampswill also be used to determine indexes from the given dates.- file
str The name of the file that contain the dates. You must format the file as following:
one date per line
all line that start with a # will be ignored
you can leave blank lines and whitespaces
A small example can be:
# first date 2000-01-01 00:00:00 2000-02-01 00:00:00 # comment 2000-05-01 00:00:00
- date_format
str The format of the dates in the file. This function will use the
datetimemodule to read the dates, the basic formats are:Basic format# Format
Meaning
Examples
%Y
year
1990, 2000
%m
zero-padded month
01, 12
%d
zero-padded day in decimal
01, 31
%H
zero-padded hour in 24-hour clock format
00, 23
%M
zero-padded minutes
00, 59
%S
zero-padded seconds
00, 59
See the datetime documentation for more information on date format.
- train_first
bool, optionnal By default:
True. If sets onTruethe first split will be set for training, else, the first split will be for evaluation.
Returns#
tupleA tuple that contains two elements: training data and testing data. Each element is itself a tuple that contains three elements: inputs, targets, timestamps.
- inputs