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#

inputspd.DataFrame

The inputs data to be split.

targetspd.DataFrame

The targets data to be split.

timestampspd.DataFrame

The timestamps data to be split. timestamps will also be used to determine indexes from the given dates.

filestr

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_formatstr

The format of the dates in the file. This function will use the datetime module 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_firstbool, optionnal

By default: True. If sets on True the first split will be set for training, else, the first split will be for evaluation.

Returns#

tuple

A tuple that contains two elements: training data and testing data. Each element is itself a tuple that contains three elements: inputs, targets, timestamps.