你好,
我認為您需要在最後一個 New Column 語句中指定矩陣(見下文)。 我無法測試它,因為您的腳本還有其他錯誤。
nrun=10;
nTraining = 0.75;
nVal = 0.25;
mat = J(1,3);
mat [1,1] = nTraining;
mat [1,2] = nVal;
mat [1,3] = 0;
//getting this error
//Invalid matrix token.
//Line 232 Column 38: ...ake Validation Formula( [►nTraining, nVal, 0], <<ST... for=""></ST...>
很抱歉 JSL 腳本中的拼寫錯誤。 這是正確的語法。
nrun=10;
nTraining = 0.75;
nVal = 0.25;
mat = J(1,3);
mat [1,1] = nTraining;
mat [1,2] = nVal;
mat [1,3] = 0;
//getting this error
//Invalid matrix token.
//Line 232 Column 38: ...ake Validation Formula( [►nTraining, nVal, 0], <<ST... for=""></ST...>
再次抱歉,我試圖回答得太快了。 我沒有合適的 JMP 版本來測試這個問題,但我想我解決了這個問題。
nrun=10;
nTraining = 0.75;
nVal = 0.25;
mat = J(1,3);
mat [1,1] = nTraining;
mat [1,2] = nVal;
mat [1,3] = 0;
//getting this error
//Invalid matrix token.
//Line 232 Column 38: ...ake Validation Formula( [►nTraining, nVal, 0], <<ST... for=""></ST...>
你好,
為了探索所有途徑,您是否嘗試過生成轉置矩陣?
nTraining = 0.75;
nVal = 0.25;
mat = J(3,1);
show (mat);
mat [1,1] = nTraining;
mat [2,1] = nVal;
mat [3,1] = 0;
show (mat);
//getting this error
//Invalid matrix token.
//Line 232 Column 38: ...ake Validation Formula( [►nTraining, nVal, 0], <<ST... for=""></ST...>
我無法判斷該公式是否會被接受,因為我沒有可用的 JMP Pro,但至少,它會在公式中生成一個以逗號分隔的矩陣。
很抱歉沒有提供更大的幫助。
最好的,
TS
嗨蒂埃里,
你的建議實際上非常接近。 您建議在需要 3x1 矩陣時構建 1x3 矩陣
dtstub= data table("test");
nrun=3;
nTraining = 0.75;
nVal = 0.25;
// Create the matrix
mat = J(3,1, {.}); // 1x3 matrix with missing values
mat [1,1] = nTraining;
mat [2,1] = nVal;
mat [3,1] = 0;
show (mat);
For( i = 1, i <= nrun, i++,
data table("test") <<
New Column( "Val",
Numeric,
"Nominal",
Format( "Best", 12 ),
Formula(
EVal (Eval Expr (Make Validation Formula(
expr(mat),
// [0.75, 0.25, 0],
<<STRATIFICATION columns=""></STRATIFICATION>在評估 ML 模型性能的過程中,我嘗試創建一個 UI,用於指定模型將執行的運行次數以及指定訓練和驗證數據的比例。
我試圖將該信息傳遞到一個 for 循環中,該循環將根據指定的運行次數創建列,並傳遞比例。 當我指定比例(第二個示例)時,循環工作正常,但在使用變量(nTraining、nVal)時則不然。
一些建議將不勝感激。
謝謝。
S
dtsub=New Table( "test",
Add Rows( 34 ),
New Column( "test_article",
Character( 7 ),
"Nominal",
Set Values(
{"1269442", "1100729", "1269449", "1269448", "1100723", "1100728",
"1269456", "1269457", "1269458", "1269454", "1269468", "1269469",
"1269466", "1269471", "1100397", "1100405", "1100406", "1100407",
"1100528", "1100534", "1100535", "1100540", "1100542", "1100566",
"1100585", "1100590", "1100725", "1100873", "1100914", "1100915",
"1100920", "1100990", "1100991", "1101101"}
),
Set Display Width( 61 )
),
New Column( "basic_class",
Character,
"Nominal",
Set Values(
{"0_Active", "0_Active", "0_Active", "0_Active", "0_Active", "0_Active",
"0_Active", "0_Active", "0_Active", "0_Active", "0_Active", "0_Active",
"1_MarginalActive", "1_MarginalActive", "1_MarginalActive",
"1_MarginalActive", "1_MarginalActive", "1_MarginalActive", "2_Inactive",
"1_MarginalActive", "2_Inactive", "1_MarginalActive", "2_Inactive",
"1_MarginalActive", "1_MarginalActive", "1_MarginalActive", "0_Active",
"1_MarginalActive", "0_Active", "0_Active", "2_Inactive", "0_Active",
"0_Active", "0_Active"}
),
Set Display Width( 90 )
),
Set Row States(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1,
1, 0, 1, 0, 0, 0, 0, 0, 0]
)
);
nrun=10;
//the proportion forthe valdation column are specified here
nTraining = 0.75;
nVal = 0.25;
//getting this error
//Invalid matrix token.
//Line 232 Column 38: ...ake Validation Formula( [►nTraining, nVal, 0], <<ST... for=""></ST...>