setenum()

Read(2631) Label: setenum,

Here are how to use setenum() functions.

A.setenum()

Description:

Map enumerated values as integers.

Syntax:

A.setenum()

During modeling, map members in enumerated variable A as integers and return a binary sequence containing the mapping result and mapping process records Rec

A.setenum@r(Rec)

During scoring, perform mapping in the same rule on enumerated variable A according to mapping process records Rec; map each new enumerated value in the scoring data as 0

Note:

The external library function (See External Library Guide) maps enumerated values as integers.

Parameter:

A

A sequence of enumerated variable values

Rec

A sequence of mapping process records

Option:

@c

Change original data into mapping result after execution

Return value:

A sequence

Example:

 

A

 

1

[a,b,f,r,g,j,r]

 

2

[b,a,f,r,g,j,r,p]

 

3

=A1.setenum@c()

A3(1) Mapping result;

A3(2) Mapping process records Rec.

@c Change original data into mapping result.

4

=A2.setenum@r(A3(2))

Map members of A2 according to A3’s mapping process records Rec.

P.setenum()

Description:

The external library function (See External Library Guide) maps enumerated variable values as integers.

Syntax:

P.setenum(cn)

During modeling, map values of enumerated variable cn as integers and return a binary sequence containing the mapping result and mapping process records Rec

 

 

P.setenum@r(cn, Rec)

During scoring, map values of enumerated variable cn as integers according to mapping process records Rec

 

 

Parameter:

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

Rec

A sequence of mapping process records

Option:

@c

Change original data into mapping result after execution

Return value:

A sequence

Example:

 

A

 

1

=T("D://house_prices_train.csv")

Import modeling data.

2

=T("D://house_prices_test.csv")

Import scoring data.

3

=A1.setenum("MSZoning")

A3(1) Mapping result;

A3(2) Mapping process records Rec.

4

=A2.setenum@r("MSZoning",A3(2))

Map values of variable “MSZoing” in the scoring data in the same rule according to A3’s removing process records.