我目前有一個生成隨機X列的腳本,根據X計算Y列,生成預測Y列,殘差列(預測Y - Y)和預測Y列。從那裡,我的代碼選擇殘差低於3的行並刪除它們。
我想再添加更多行的增強數據點,並再次進行循環,以減少殘差。以下是我的代碼:
// 1. Creates X1 column, and corresponding Y1 and Ystat columns
Close All( Data Tables, NoSave );
dt = New Table( "SampleRun 3",
Add Rows( 100 ),
New Script(
"Ystat vs. X1",
Graph Builder(
Variables( X( :X1 ), Y( :Ystat ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
)
),
New Column( "X1",
Formula( Random Integer( 50 ) )
),
New Column( "Y1",
Formula( If( :X1 < 25, 2 * :X1, 25 <= :X1 <= 30, 3 * :X1, 4 * :X1 ) )
),
New Column( "Ystat",
Formula( :Y1 )
)
);
// 2. Creates predicted Ystat column, saves formulas into same data table (first iteration)
PredictedYstat = dt << Neural(
Y( :Ystat ),
X( :X1 ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.3333 ),
Fit( NTanH( 3 ) )
);
PredictedYStat << Save Profile Formulas;
// 3. Adds residual column
dt << New Column( "Residual 1", Formula( Abs( :Predicted Ystat - :Ystat ) ) );
Column( dt, "X1" ) << Suppress Formula Eval();
Column( dt, "Y1" ) << Suppress Formula Eval();
Column( dt, "Ystat" ) << Suppress Formula Eval();
dt << Select where( :Residual 1 <= 3 );
dt << delete rows;
// 4. Creates and predicts residual column
PredictedResidual = dt2 << Neural(
Y( :Residual 1 ),
X( :X1 ),
Informative Missing( 0 ),
Validation Method( "Holdback", 0.3333 ),
Fit( NTanH( 3 ) )
);
PredictedResidual << Save Profile Formulas;
// 5. Adds new data points, cycle starts over from 2 (lets user choose how many)
// Iteration 2
DOE( Augment Design, X( :X1 ), Y( :Ystat ), {Make Design, Make Table} );
dt << add rows();
但最後一塊代碼(它應該添加行的地方)並沒有做任何事情。有什麼建議?
謝謝,
凱爾
是的,它應該是dt而不是dt2。謝謝你的糾正。如果添加rows();期望一個指定的值,我如何將增強設計中的更多X值添加到我的代碼中指定的數據表“Sample Run 3”的末尾?對不起,如果這非常容易,我對JMP / JSL很新。
謝謝
我相信這是做你想要的最直接的方式:
d = DOE( Augment Design, X( :X1 ), Y( :Ystat )/*, {Make Design, Make Table}*/ );
d << Make Design;
dt2 = d << Make Table;
dt << concatenate( dt2, Append to first table( 1 ) );
請記住,JMP不是Excel或R.在JMP中,您不必編寫複雜的代碼來完成任務。 很多時候,使用其中一個JMP平台會更容易,比如“連接”