cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
lala
Level VIII

如何引用已运行平台的输出报告和生成它的可执行对象?

大家好!

我打开这个文件、用手动进行了决策树模块的操作。

 

在这时才在脚本中定义这个决策树的窗口、要怎样编写代码?谢谢!

2022-03-10_14-06-20.png2022-03-10_14-09-02.png

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: 如何在脚本中临时指定当时的窗口?

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;
Jim

View solution in original post

10 REPLIES 10
txnelson
Super User

Re: 如何在脚本中临时指定当时的窗口?

To get the script that will generate the Partition, go to the red triangle and select 

     Save Script=>To Script Window

txnelson_0-1646894257613.png

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();

 

Jim
lala
Level VIII

Re: 如何在脚本中临时指定当时的窗口?

Thank Jim!

 

I see, the original P is shown as successful.


I've tried P before.

p=current report();

Think it's not gonna work.

 

2022-03-10_14-53-01.png

 

txnelson
Super User

Re: 如何在脚本中临时指定当时的窗口?

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 );
Jim
lala
Level VIII

Re: 如何在脚本中临时指定当时的窗口?

是的、执行决策树的代码这样编写。

 

我不编写决策树的执行代码是为了进行试验、看见效果适合才将决策树后面的操作用代码完成。

 

谢谢!

txnelson
Super User

Re: 如何在脚本中临时指定当时的窗口?

Are you looking to adjust the size of the Data Table Window?

Names Default To Here( 1 );
//This message applies to all display box objects
w = Open( "$SAMPLE_DATA/Big Class.jmp" );
w << Set Window Size( 800, 1200 );
Jim
lala
Level VIII

Re: 如何在脚本中临时指定当时的窗口?

我主要需要分割后的统计全部自动进行。

分割过程可以自己手动逐一观察

lala
Level VIII

Re: 如何在脚本中临时指定当时的窗口?

p << save prediction formula;
p << save leaf label formula;
p << Close Window;
……
txnelson
Super User

Re: 如何在脚本中临时指定当时的窗口?

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;
Jim
pmroz
Super User

Re: 如何在脚本中临时指定当时的窗口?

Here's another approach that doesn't require getting the report.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

prt = dt << 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 )} ) )
);

prt << save prediction formula;
prt << save leaf label formula;