Smoothing categorical variable

 

The variable can be smoothed using the A.smooth(T) or P.smooth(cn, T) functions, which can eliminate the influence of the value size after mapping to integers.

For example, smooth the “Ticket” variable in titanic data:


A

1

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

2

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

3

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

4

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

A1 Import the modeling data

A2 Import the prediction data

A3 Use P.smooth(cn, T) to smooth Ticket, return the smoothing result and the smoothing record Rec

..

A4 Smoothing is performed on the prediction set according to the smoothing record of A3

..