大家好!
我打开这个文件、用手动进行了决策树模块的操作。
在这时才在脚本中定义这个决策树的窗口、要怎样编写代码?谢谢!
Is this what you are looking for?
Names Default To Here( 1 ); dt = Open( "$SAMPLE_DATA/big class.jmp" ); Partition( Y( :weight ), X( :age, :sex, :height ), Informative Missing( 1 ), Initial Splits( :height < 65, {:height < 60, {}, {:age == {12, 13}, {}, {:age == {14}}}} ), SendToReport( Dispatch( {}, "Partition Report", FrameBox, {Frame Size( 480, 102 )} ) ) ); p = Current Report(); x = p[Outline Box( 1 )] << get scriptable object(); x << save prediction formula; x << save leaf label formula; p << close window;
To get the script that will generate the Partition, go to the red triangle and select
Save Script=>To Script Window
It will provide you with the following script
Partition( Y( :weight ), X( :age, :sex, :height ), Split History( 1 ), Informative Missing( 1 ), Initial Splits( :height < 65, {:height < 60, {}, {:age == {12, 13}}} ), SendToReport( Dispatch( {}, "Partition Report", FrameBox, {Frame Size( 480, 82 )} ), Dispatch( {}, "Split History", OutlineBox, {Close( 1 )} ) ) );
You can reference this window with
p=current report();
Thank Jim!
I see, the original P is shown as successful.
I've tried P before.
Think it's not gonna work.
You can reference either the Current Report or the Window directly and specify the window size. Here is a working example
Names Default To Here( 1 ); dt = Open( "$SAMPLE_DATA/big class.jmp" ); Partition( Y( :weight ), X( :age, :sex, :height ), Informative Missing( 1 ), Initial Splits( :height < 65, {:height < 60, {}, {:age == {12, 13}, {}, {:age == {14}}}} ), SendToReport( Dispatch( {}, "Partition Report", FrameBox, {Frame Size( 480, 102 )} ) ) ); Wait( 5 ); x = Current Report(); x << Set Window Size( 1200, 1200 ); Wait( 5 ); p = Window( "big class - Partition of weight" ); p << Set Window Size( 800, 1200 );
是的、执行决策树的代码这样编写。
我不编写决策树的执行代码是为了进行试验、看见效果适合才将决策树后面的操作用代码完成。
谢谢!