如何在自定義分析器的公式中傳遞變量我們可以在自定義分析器中定義自定義公式,這很容易,如以下示例所示
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Tiretread.jmp" );
obj = Custom Profiler( Y( :Pred Formula ABRASION, :Pred Formula MODULUS ) );
obj << Objective Formula(
:Pred Formula ABRASION + .5 * :Pred Formula MODULUS
);
obj << Optimize;
現在,假設我想將係數值從 0.5 更改為另一個設置。 所以我定義了以下公式:
coef=4;
myFormula=Parse(eval(EvalExpr(":Pred Formula ABRASION + "||Char(coef)||" * :Pred Formula MODULUS")));
日誌中的結果沒問題:
:Pred Formula ABRASION + 4 * :Pred Formula MODULUS
但是,如果我在前面的語句中使用相同的句子,我不會成功獲得預期的結果:
obj << Objective Formula(Parse(eval(EvalExpr(":Pred Formula ABRASION + "||Char(coef)||" * :Pred Formula MODULUS"))));

我可能犯了一個基本錯誤,但我遇到了麻煩。我想使這種方法適應更複雜的情況(改變本機表達式中的合意性係數)
謝謝你的建議
回复:如何在自定義分析器的公式中傳遞變量佛羅倫薩,
通常,最好將表達式視為表達式而不是要計算的文本字符串。 這將起作用:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Tiretread.jmp" );
obj = Custom Profiler( Y( :Pred Formula ABRASION, :Pred Formula MODULUS ) );
cVal = 4;
Eval(Substitute(
Expr(
obj << Objective Formula(
:Pred Formula ABRASION + coefVal * :Pred Formula MODULUS
)
),
Expr(coefVal),cVal
));
obj << Optimize;
大學教師
回复:如何在自定義分析器的公式中傳遞變量嗨,唐,
非常感謝您的回答。
在這個基本示例中,它工作得很好,因為我的公式很簡單。
在現實生活中,我的情況更為複雜。 我希望能夠設置我將從數據表中捕獲的期望值的內容。
y1_target_value=175;
y1_min=150;
y1_max=200;
y2_target=500;
y2_min=450;
y2_max=550;
Eval(Substitute(
Expr(
obj << Objective Formula(
Exp((0.25 * Log(Desirability([100, y1_target, 200], [0.0183, 1, 0.0183], Pred Formula Abrasion)) + 0.25 * Log(Desirability([400, 475, 550], [0.0183, 1, 0.0183], Pred Formula Elongation))) / 0.5)
)
),
Expr(y1_target),y1_target_value
));
obj << Optimize;
如果我在這種情況下應用替代品,我會出錯。

是的.... 我想更改 6 個變量的內容(兩個 Y 的 target 和 spec)!!
謝謝你的建議,
佛羅倫薩
回复:如何在自定義分析器的公式中傳遞變量佛羅倫薩,
這個問題與矩陣運算符(左方括號和右方括號)的工作方式有關。 我能想到的最簡單的方法是預先創建矩陣並將它們作為一個整體來對待,而不是試圖在代替. 這應該工作
y1_target_value=175;
y1_min=150;
y1_max=200;
y2_target=500;
y2_min=450;
y2_max=550;
y1Mat = Matrix({y1_min,y1_target_value,y1_max});
y2Mat = Matrix({y2_min,y2_target,y1_max});
Eval(Substitute(
Expr(
obj << Objective Formula(
Exp((0.25 * Log(Desirability(y1Mat, [0.0183, 1, 0.0183], Pred Formula Abrasion)) + 0.25 * Log(Desirability(y2Mat, [0.0183, 1, 0.0183], Pred Formula Elongation))) / 0.5)
)
),
Expr(y1Mat),y1Mat,
Expr(y2Mat),y2Mat,
));
obj << Optimize;
回复:如何在自定義分析器的公式中傳遞變量我覺得我在這裡錯過了什麼。 為什麼要用 Expr/Eval 等而不是直接把公式放進去呢?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Tiretread.jmp" );
y1_target_value = 175;
y1_min = 150;
y1_max = 200;
y2_target = 500;
y2_min = 450;
y2_max = 550;
y1Mat = Matrix( {y1_min, y1_target_value, y1_max} );
y2Mat = Matrix( {y2_min, y2_target, y1_max} );
obj = Custom Profiler( Y( :Pred Formula ABRASION, :Pred Formula MODULUS ) );
obj << Objective Formula(
Exp(
(0.25 * Log( Desirability( y1Mat, [0.0183, 1, 0.0183], :Pred Formula Abrasion ) ) + 0.25 * Log(
Desirability( y2Mat, [0.0183, 1, 0.0183], :Pred Formula Elongation )
)) / 0.5
)
);
obj << Optimize;
回复:如何在自定義分析器的公式中傳遞變量如果你看一下表達式中的公式大綱,值y1墊和y2墊出現未評估,即作為變量:
Exp((0.25 * Log(Desirability(<FONT color="#FF0000">y1Mat</FONT>, [0.0183, 1, 0.0183], :Pred Formula Abrasion)) + 0.25 * Log(Desirability(<FONT color="#FF0000">y2Mat</FONT>, [0.0183, 1, 0.0183], :Pred Formula Elongation))) / 0.5)
順便說一句,看起來我在之前的代碼中有一些錯誤。 這是更正後的版本
y1_target_value=175;
y1_min=150;
y1_max=200;
y2_target=500;
y2_min=450;
y2_max=550;
y1Mat = Matrix({y1_min,y1_target_value,y1_max});
y2Mat = Matrix({y2_min,y2_target,y2_max});
Eval(Substitute(
Expr(
obj << Objective Formula(
Exp((0.25 * Log(Desirability(y1Mat, [0.0183, 1, 0.0183], :Pred Formula Abrasion)) + 0.25 * Log(Desirability(y2Mat, [0.0183, 1, 0.0183], :Pred Formula Elongation))) / 0.5)
)
),
Expr(y1Mat),y1Mat,
Expr(y2Mat),y2Mat,
));
obj << Optimize;
綜上所述,我不確定這是為意願函數實現不同邊界的方法。 公式看似正確,但缺少目標值。
回复:如何在自定義分析器的公式中傳遞變量感謝您的小費!有用
關於公式,它是我在使用 Fit Model 平台生成的預測公式啟動自定義刻畫器時由 JMP 定義的。
默認值如下:

使用這種類型的預測公式:

我將檢查我的結果是否與原生模型擬合平台上的結果相同。
再次感謝!
回复:如何在自定義分析器的公式中傳遞變量謝謝佛羅倫薩,
我發現了問題。 我用了磨損和模數在自定義分析器但用過磨損和伸長在裡面目標公式.
這是(希望如此)無錯誤代碼:
obj = Custom Profiler( Y( :Pred Formula ABRASION, :Pred Formula MODULUS ) );
y1_target_value=175;
y1_min=150;
y1_max=200;
y2_target=500;
y2_min=450;
y2_max=550;
y1Mat = Matrix({y1_min,y1_target_value,y1_max});
y2Mat = Matrix({y2_min,y2_target,y2_max});
Eval(Substitute(
Expr(
obj << Objective Formula(
Exp((0.25 * Log(Desirability(y1Mat, [0.0183, 1, 0.0183], :Pred Formula Abrasion)) + 0.25 * Log(Desirability(y2Mat, [0.0183, 1, 0.0183], :Pred Formula Modulus))) / 0.5)
)
),
Expr(y1Mat),y1Mat,
Expr(y2Mat),y2Mat,
));
obj << Optimize;