如果缺少異常值 jsl 中沒有異常值,如何忽略?我有一個在大型數據庫上運行的探索異常值 jsl。 有時explore outlier找不到任何異常值(因為數據分佈相當緊密),jsl報錯。 如何在以下腳本中添加 ignore 或 try 語句以跳過探索異常值代碼?
dt1 = Current Data Table();
eo = dt1 << Explore Outliers(
Y( :var1 ),
K Sigma( 2 ),
Robust Fit Outliers,
Where(
:x == 1
),
Invisible
);
eoRep = Report(eo);
table = eoRep[TableBox(1)];
colList = eoRep[StringColBox(1)];
// Loop over these columns . . .
nCols = NItems(colList << get);
for(c=1, c<=nCols, c++,
// Select this column (described by a row)
CMD = Expr( table << setSelectedRows({colTBD}) );
SubstituteInto(CMD, Expr(colTBD), Eval(c));
CMD;
// Update dt2 for this column: Cells that were considered outliers are coloured red
eo << ColorCells(1);
eo << ChangeToMissing(1);
);數據表腳本視窗回复:如果缺少異常值 jsl 中沒有異常值,如何忽略?我相信您可以通過簡單地檢查是否已找到零異常值來繞過處理
For( c = 1, c <= nCols, c++,
If( (eoRep[Number Col Box( 3 )] << get)[c] != 0,
// Select this column (described by a row)
CMD = Expr(
table << setSelectedRows( {colTBD} )
);
Substitute Into( CMD, Expr( colTBD ), Eval( c ) );
CMD;
// Update dt2 for this column: Cells that were considered outliers are coloured red
eo << ColorCells( 1 );
eo << ChangeToMissing( 1 );
)
);