datederive()

Read(36) Label: datederive,

Here are how to use datederive() functions.

A.datederive()

Description:

The external library function generates multiple derivative variables for a datetime sequence variable.

Syntax:

A.datederive(T)

During modeling, generate multiple variables for datetime variable A for building models and return a binary sequence where the first bit is a table sequence made up of all the derivative variables and the second bit is generation process records Rec; the derivative variables automatically perform subsequent pre-processing

A.datederive@r(Rec)

During scoring, generate a table sequence consisting of multiple derivative variables used for model building according to datetime variable A and generation process records Rec

Parameters:

A

A sequence of datetime variable values

T

The target variable value used to perform potential data smoothing

Rec

A sequence of generation process records

Options:

@bnie

Each option specifies a target type, and options are mutual-exclusive; automatically judge the type when no option is used; the order of priorities of the options is binary, numeric, integer and enumerated

Return value:

A sequence/table sequence

Example:

 

A

 

1

=100.(date(2020,rand(11)+1,rand(28)+1))

Generate training data, which is a sequence of datetime variable values

2

=100.(date(2021,rand(11)+1,rand(28)+1))

Generate scoring data, which is a sequence of date variable values

3

=100.(rand(500))

Generate a target variable

4

=A1.datederive@i(A3)

A4(1) A table sequence of derivative variables

A4(2) Generation process records Rec

@i specifies the target variable as integer

5

=A2.datederive@r(A4(2))

Generate derivative variables on the scoring data according to A4’s generation process records Rec

P.datederive()

Description:

The external library function generates multiple derivative variables from a date table sequence/record sequence variable.

Syntax:

P.datederive(cn, T)

During modeling, generate multiple variables for datetime variable cn for building models and return a binary sequence where the first bit is a table sequence made up of all the derivative variables and the second bit is generation process records Rec; the derivative variables automatically perform subsequent pre-processing

P.datederive@r(cn, Rec)

During scoring, generate a table sequence consisting of multiple derivative variables used for model building according to datetime variable cn and generation process records Rec

Parameters:

P

A table sequence/record sequence

cn

A string/number, which is the name of column (or the column number starting from 1) – the to-be-pre-processed variable – in a table sequence or record sequence

T

The target variable value used to perform potential data smoothing

Rec

A sequence of generation process records

Options:

@bnie

Each option specifies a target type, and options are mutual-exclusive; automatically judge the type when no option is used; the order of priorities of the options is binary, numeric, integer and enumerated

Return value:

A sequence/table sequence

Example:

 

A

 

1

=T("D: //catering_sale.csv").run(date1=date(date1,"yyyy/MM/dd"))

 

2

=A1.datederive@i("date1","sales")

Take “sales” as the target variable and generate multiple derivative variables for date variable “date1”:

A2(1) A table sequence of derivative variables

A2(2) Generation process records Rec

@i specifies the target variable as integer

3

=A1.datederive@r("date1",A2(2))

Generate derivative variables for “date1” according to A2’s generation process records Rec, and return a table sequence of derivative variables