smooth()

Read(63) Label: smooth,

Here are how to use smooth() functions.

A.smooth()

Description:

The external library function performs smoothing on a sequence type variable during modeling.

Syntax:

A.smooth(T)

During modeling, perform smoothing on high-frequency categorical enumerated variable A and return a binary sequence containing the smoothing result and the smoothing records Rec

A.smooth@r(Rec)

During scoring, perform smoothing on multiclassification enumerated variable A according to Rec, the smoothing process records, and return the smoothing result

Parameters:

A

A sequence containing high-frequency categorical enumerated varaibles

T

A sequence of target variable values

Rec

A sequence of smoothing process records

Options:

@c

Modify the original data to the smoothing result after execution

@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

Example:

 

A

 

1

[a,d,f,g,y,j,y,k,l,v,x,,w,t,j,c,,z,h,y,j,e,e,s,d,q,ad,gr,hy,ki,lo,ss,df,afd,ju,li,ol]

Input a sequence of high-frequency categorical variables

2

=A1.len().(rand(100))

Generate a sequence of integers of same length as A1

3

=A1.setenum@c()

Map A1 as integers and modify the original data

4

=A1.smooth(A2)

Take A2 as the target variable, perform smoothing on A1, and return smoothing result and smoothing process records Rec

5

=A1.smooth@r(A3(2))

Perform smoothing on A1 according to A3’s smoothing process records; often used to smooth the score data

P.smooth()

Description:

The external library function performs smoothing on a table sequence/record sequence variable of a table sequence/ record sequence during modeling.

Sytnax:

P.smooth(cn, T)

During modeling, perform smoothing on high-frequency categorical enumerated variable cn and return a binary sequence containing the smoothing result and the smoothing records Rec

P.smooth@r(cn, Rec)

During scoring, perform smoothing on multiclassification enumerated variable cn according to Rec, the smoothing process records, and return the smoothing result

Parameters:

P

A table sequence/record sequence

T

A sequence of target variable values

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 smoothing process records

Options:

@c

Modify the original data to the smoothing result after execution

@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

Example:

 

A

 

1

=file("D:// titanic.csv").import@qtc()

Import the modeling data

2

=file("D:// titanic_t.csv").import@qtc()

Import the scoring data

3

=A1.smooth@ic("Ticket",A1.(Survived))

Smooth variable “Ticket” and return the smoothing result and the smoothing process records Rec

4

=A2.smooth@rc("Ticket",A3(2))

Map the corresponding variable in the scoring data set according to A3’s smoothing process records