조금 놀아봤는데,
- Big Class(x와 y는 체중과 키, 클래스는 성별)에서 데이터를 가져왔습니다.
- KNN 분석 작성, Formula 저장
- 별도의 테이블에 그리드를 생성하고 공식을 해당 그리드에 복사하여 "결정 영역"을 표시했습니다.
스크린샷을 참조하십시오. 더 예쁠 수 있지만(데이터 분포 등으로 인해) 의미하는 바를 보여줍니다.
코딩을 원하지 않는다면 대화식으로도 할 수 있습니다. 이 예제의 코드가 동봉되어 있습니다. 아마도 이것이 도움이 될 수 있습니다.

Names Default To Here( 1 );
// Create a data table (x and y are height and weight from Big Class, class is sex)
dt_data= New Table( "dt_data",
Add Rows( 40 ),
New Column( "x", Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Values(
[59, 61, 55, 66, 52, 60, 61, 51, 60, 61, 56, 65, 63, 58, 59, 61, 62, 65, 63, 62,
63, 64, 65, 64, 68, 64, 69, 62, 64, 67, 65, 66, 62, 66, 65, 60, 68, 62, 68, 70]
),
Set Display Width( 48 )
),
New Column("y", Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Values(
[95, 123, 74, 145, 64, 84, 128, 79, 112, 107, 67, 98, 105, 95, 79, 81, 91, 142,
84, 85, 93, 99, 119, 92, 112, 99, 113, 92, 112, 128, 111, 105, 104, 106, 112,
115, 128, 116, 134, 172]
),
Set Display Width( 48 )
),
New Column( "class", Numeric,
"Nominal",
Format( "Best", 12 ),
Set Values(
[1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 1, 2, 2]
)
),
);
// Model class by x and y and save formula
knn_rep = dt_data << K Nearest Neighbors(
Y( :class ),
X( :x, :y ),
K( 10 ),
Set Random Seed( 42 )
);
knn_rep << xpath( "class" ) << Save Prediction Formula( 8 );
knn_rep << Close Window();
// Generate a grid data table to show the whole field
Summarize(
dt_data,
max_x = Max( :x ),
min_x = Min( :x ),
max_y = Max( :y ),
min_y = Min( :y )
);
dx = 1;
get_limit = Function( {value},
Round( value / dx ) * dx + If( value >= 0, 1, -1 ) * dx
);
dtx = As Table(
(get_limit( min_x ) / dx :: get_limit( max_x ) / dx)` * dx,
<<COLUMN names=""></COLUMN>