Equi-width binning
The range of variable value is divided into k equal width intervals, each of which is regarded as a bin. Here, only boundary is considered, and the sample size in each bin may be different.
For example, Equi-width binning the “Fare” variable
A |
|
1 |
=file("D://titanic.csv").import@qtc() |
2 |
=A1.(Fare).max() |
3 |
=A1.(Fare).min() |
4 |
3 |
5 |
=(A2-A3)/A4 |
6 |
=A4.((~-1)*A5+A3) |
7 |
=A1.derive(if(Fare<=A6(2),"low",if(Fare>A6(3),"hign","middle")):Fare_equiwidth_binning) |
A5 Calculate the length of each bin
A6 Calculate the boundary values for each bin
A7 Binning fare according to boundary values
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProcSPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL