<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() );
ありがとう。
また、除外された行の数に応じて線形にスケールするバージョンも追加しました (除外された行は 1 つずつ削除されます)。
除外される行の数が少ない場合には非常に競争力がありますが、数が多い場合はパフォーマンスがますます低下します。
約 200 行を除外すると、ジムのバージョンのパフォーマンスに達し、その後は非常に悪くなります...
さらに、ジムのバージョンよりも 2 倍高速なバージョン (「ジム X」) と、さらに短いコードを見つけました。
nonExludedRows = dt << get rows where( Excluded() == 0 );
最も重要な:
ジャーモのバージョンが断然最高です。
</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);
また、最速であることが常に最良であるとは限らないことにも留意することをお勧めします。