<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />이 작업을 수행하는 '간단한' 구문을 아는 사람이 있나요?col<Re: col<<제외되지 않은 행의 값을 얻으시겠습니까?
제안해 주셔서 감사합니다. JMP 18은 여기에서 논의된 특정 쿼리와 기타 유사한 쿼리의 성능과 가독성을 향상시키는 새로운 일련의 JSL 기능을 구현합니다. 선호하는/더 빠른 방법을 반영하도록 문서도 업데이트되었습니다.
JSL은 다음과 같습니다.
//instead of Get Rows Where()
Where( dt, Excluded() );
Where( dt, !Excluded() );
Where( dt, Hidden() );
Where( dt, !Hidden() );
Where( dt, Labeled() );
Where( dt, !Labeled() );
Where( dt, Is Missing() );
감사해요.
또한 제외된 행 수에 따라 선형적으로 확장되는 버전도 추가했습니다(제외된 행은 하나씩 제거됨).
소수의 제외된 행에 대해서는 상당히 경쟁력이 있지만 숫자가 많을수록 성능이 점점 더 나빠집니다.
약 200개의 제외된 행이 Jim 버전의 성능에 도달했지만 정말 나빴습니다.
또한 Jim의 버전보다 2배 정도 빠르고 코드도 더 짧은 버전("Jim X")을 찾았습니다.
nonExludedRows = dt << get rows where( Excluded() == 0 );
가장 중요한:
Jarmo 버전이 단연 최고입니다.
</CODE></P><P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_4-1667508531636.png" style="width: 400px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="hogi_4-1667508531636.png" style="width: 400px;"><span class="lia-inline-image-display-wrapper" image-alt="hogi_4-1667508531636.png" style="width: 400px;"><img src="https://us.v-cdn.net/6038925/uploads/images/46881iC5718A32059D8FB7/hogi_4-1667508531636.png" role="button" title="hogi_4-1667508531636.png" alt="hogi_4-1667508531636.png" /></span></SPAN></SPAN></P><DIV class="lia-spoiler-container"><A class="lia-spoiler-link" href="#" rel="nofollow noopener noreferrer" target="_blank">더보기...</A><NOSCRIPT><DIV class="lia-spoiler-content"><PRE><CODE class=" language-jsl">dt = New Table( "dummy table" );
NR = 10E6;
dt << add rows( NR );
dt << New Column( "random", set each value( Random Uniform( 0, 100 ) ) );
For Each( {percent, idx},
{0.00001, 0.00002, 0.00005, 0.0001, 0.0002, 0.0005, 0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 15, 20, 30, 40, 50, 60,
70, 80, 90, 100},
Print( percent );
dt << Clear Row States;
dt << select where( :random < percent );
dt << Hide and Exclude;
nexcl = N Rows( dt << Get Excluded Rows );
dt << Clear Select;
Wait();
// Jim
bt = HP Time();
allRows = dt << get rows where( Excluded( Row State( Row() ) ) == 0 );
et = HP Time();
time1 = et - bt;
// Jim X
bt = HP Time();
allRows = dt << get rows where( Excluded() == 0 );
et = HP Time();
time2 = et - bt;
// Jarmo
bt = HP Time();
excl_rows = dt << Get Excluded Rows;
et = HP Time();
time3a = et - bt;
all_rows = 1 :: N Rows( dt );
all_rows[excl_rows] = .;
all_rows = Loc(all_rows);
et = HP Time();
time3 = et - bt;
// hogi
If( idx < 11,
bt = HP Time();
excl = dt << Get Excluded Rows;
allRows = (1 :: N Rows( dt ));
For Each( {i, j}, Reverse( excl ), Remove From( allRows, i, 1 ) );
et = HP Time();
time4 = et - bt;
);
Wait();
If( idx == 1,
New Window( "timing results",
tb = Table Box(
Number Col Box( "# excluded", {Nexcl} ),
Number Col Box( "Jim", {time1 / 1000000} ),
Number Col Box( "Jim X", {time2 / 1000000} ),
Number Col Box( "Jarmo", {time3 / 1000000} ),
Number Col Box( "Jarmo (get ... rows)", {time3a / 1000000} ),
Number Col Box( "hogi", {time4 / 1000000} ),
)
)
,
If( idx < 11,
tb << add row( {Nexcl, time1 / 1000000, time2 / 1000000, time3 / 1000000,time3a / 1000000, time4 / 1000000} ),
tb << add row( {Nexcl, time1 / 1000000, time2 / 1000000, time3 / 1000000, time3a / 1000000} )
)
);
);
results = tb << Make Combined Data Table;
gb = results << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :"# excluded"n ), Y( :Jim ), Y( :Jim X, Position( 1 ) ), Y( :Jarmo, Position( 1 ) ), Y( :hogi, Position( 1 ) ) ),
Elements( Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 5 ) ), Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 6 ), Lambda( 0.001 ) ) )
);
Report( gb )[AxisBox( 1 )] << {Scale( "Log" ), Min( 1 ), Max( 10000000 )};
Report( gb )[AxisBox( 2 )] << {Scale( "Log" ), Min( 0.1 ), Max( 10 ),Label Row( Show Minor Grid( 1 ) )};
Report( gb )[Text Edit Box( 4 )] << Set Text( "time [s]" )
가장 빠른지는 확실하지 않지만 작동할 것입니다(추가 오류 처리가 필요할 수 있음).
Names Default To Here(1);
/* init */
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Select Rows([2,3,4,30]) << Exclude(1) << Clear Select;
// get row indices
excl_rows = dt << Get Excluded Rows;
all_rows = 1::N Rows(dt);
all_rows[excl_rows] = .;
all_rows = Loc(all_rows);
또한 가장 빠른 것이 항상 최고는 아니라는 점을 명심하는 것이 좋습니다.