이것은 해결하기 쉬운 질문처럼 보이지만 다소 붙어 있습니다.
250 개의 행과 약 20K 개의 열이있는 데이터 세트가 있습니다. 행은 양호 (249 행)와 불량 (1 행)의 두 가지 범주로 나뉩니다. 'BAD'행이 나머지 'GOOD'행에 비해 더 높거나 낮은 값을 갖는 모든 열을 찾아야합니다.
이를 수행하는 효율적인 방법을 제안 할 수 있습니까?
감사합니다!
1 나쁜 행을 식별하는 열과 249 좋은 행을 모두 가정한다고 가정하면 어떻게해야합니까?
1. 나쁜 행과 모든 좋은 행을 식별하는 열을 유지하면서 20k 행을 모두 쌓으십시오.
테이블 ==> 스택
2. 결과 누적 테이블 요약
에이. 새 열 "라벨"로 그룹화
비. 불량 및 양호 데이터를 식별하는 열별 하위 그룹
씨. "데이터"열의 최소값 및 최대 값을 계산하기위한 사양
삼. 결과 요약 테이블에서
에이. 수식을 사용하여 "Min Max"라는 새 열 추가
If(
:Name( "Max(Data,Bad)" ) > :Name( "Max(Data,Good)" ), "Max",
:Name( "Min(Data,Bad)" ) < :Name( "Min(Data,Good)" ), "Min",
"Neither"
)
아래는 위의 결과를 생성하는 예제 스크립트입니다. 4 개의 열만있는 예제 데이터 테이블을 사용하지만 Bad 및 Good 행이있는 열을 가리키는 스크립트의 이름을 변경하여 20k 테이블에서 작동합니다 (예제 데이터 테이블에서 "GoodBad"라고 함). 불량 및 양호 데이터를 식별하는 데이터 테이블의 열 이름
스크립트는 또한 모든 숫자 열을 비교한다고 가정합니다.
Names Default To Here( 1 );
// Create a simple data table for illustration
dt = New Table( "simple",
Add Rows( 10 ),
New Column( "A", Set Values( [59, 61, 55, 66, 52, 60, 61, 51, 60, 61] ) ),
New Column( "B",
Format( "Fixed Dec", 5, 0 ),
Set Values( [22, 123, 74, 145, 64, 84, 128, 79, 112, 107] )
),
New Column( "C",
Set Values( [110, 96, 100, 92, 92, 97, 98, 94, 91, 94] ),
),
New Column( "GoodBad",
Character,
Set Values(
{"Bad", "Good", "Good", "Good", "Good", "Good", "Good", "Good", "Good", "Good"}
)
)
);
// Get All Numeric Columns
numericCols = dt << get column names(numeric);
// Stack all of the numeric
dtStack = dt << Stack(invisible,
columns( numericCols ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" )
);
// Summarize the data
dtSum = dtStack << Summary(
Group( :Label ),
Min( :Data ),
Max( :Data ),
Subgroup( :GoodBad ),
Freq( "None" ),
Weight( "None" ),
Link to original data table( 0 )
);<BR /><BR />// Delete the no longer needed Stacked data table<BR />
<SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #008000; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;">close( dtStack, nosave );</SPAN><BR />// Add the column that determines if Bad column is < or > Good
dtSum << New Column(
"Max or Min",
formula(
If(
:Name( "Max(Data,Bad)" ) > :Name( "Max(Data,Good)" ), "Max",
:Name( "Min(Data,Bad)" ) < :Name( "Min(Data,Good)" ), "Min",
"Neither"
)
)
);
D ,
tx Jim은 JMP 인터페이스 및 열 기능으로 수행 할 수있는 훌륭하고 따르기 쉬운 솔루션을 제공했습니다. 아래는 JSL 및 행렬을 사용하는 대체 솔루션입니다.
어떤 접근 방식이 최고의 성능을 발휘하는지 잘 모르겠습니다. JMP 매트릭스 표기법이나 JSL에 익숙하지 않은 경우이 응답을 JMP 커뮤니티의 다른 사용자에게 FYI로 고려하십시오.
Names Default To Here( 1 );
// Create a simple data table for illustration
dt = New Table( "simple",
Add Rows( 10 ),
New Column( "A", Set Values( [59, 66, 55, 66, 52, 60, 61, 51, 60, 61] ) ),
New Column( "B",
Format( "Fixed Dec", 5, 0 ),
Set Values( [123, 22, 74, 145, 64, 84, 128, 79, 112, 107] )
),
New Column( "C",
Set Values( [96, 110, 100, 92, 92, 97, 98, 94, 91, 94] ),
)
);
cnames = dt << get column names("string"); //need to remove column names that are not to be tested<BR />//typically cnames = cnames[n::n+249999]
//Matrix of bad row - assuming you know which row is bad, row 2.
bmat = dt[2,1::3];
glist = Remove( AsList(1::nrow(dt))[1], 2);
gmax = V Max(dt[ glist, 1::3 ]); //returns a row vector of each column max
gmin = V Min(dt[ glist, 1::3 ]); //returns a row vector of each column min
mxcol = loc(bmat - gmax > 0); //returns a row vector of column # where bmat > gmax
mncol = Loc(bmat - gmin < 0); //returns a row vector of column # where bmat < gmin
HiCol = cnames[transpose(mxcol)];
LoCol = cnames[transpose(mncol)];
show(HiCol, LoCol);
/*:
HiCol = {"C"};
LoCol = {"B"};