How to copy the list of column contributions of a random forest using a script?Thanks Experts!
dt = Open( "$SAMPLE_DATA/Diabetes.jmp" );
p= dt << Bootstrap Forest(
Y( :Y ),
X(
:Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH,
:LTG, :Glucose
),
Validation( :Validation ),
Minimum Splits Per Tree( 5 ),
Portion Bootstrap( 1 ),
Number Terms( 3 ),
Number Trees( 25 ),
Go
);
p_report = p << Report;
tb = p_report << XPath("//OutlineBox[text()='列贡献']//TableBox");
no work

Automation and Scripting回复: How to copy the list of column contributions of a random forest using a script?
Re: How to copy the list of column contributions of a random forest using a script?Use Make Into Data table, take the source script from that and modify as needed
Names Default To Here(1);
rpt = New Window("Diabetes - Bootstrap Forest of Y",
Data Table("Diabetes") << Bootstrap Forest(
Y(:Y),
X(
:Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG,
:Glucose
),
Validation(:Validation),
Method("Bootstrap Forest"),
Column Contributions(1),
Minimum Splits per Tree(5),
Portion Bootstrap(1),
Number Terms(3),
Number Trees(25),
Go
)
);
Wait(0);
rpt["Bootstrap Forest for Y", "Column Contributions", Table Box(1)] <<
Make Into Data Table;
rpt << Close Window;
View more...
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Diabetes.jmp");
bsf = dt << Bootstrap Forest(
Y(:Y),
X(:Age, :Gender, :BMI, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose),
Validation(:Validation),
Minimum Splits Per Tree(5),
Portion Bootstrap(1),
Number Terms(3),
Number Trees(25),
Column Contributions(1),
Go
);
Wait(0);
dt_res = Report(bsf)[Outline Box("Bootstrap Forest for ?"), Outline Box("Column Contributions"), Table Box(1)] << Make Into Data Table(Invisible);
m = dt_res[0, 0];
Close(dt_res, no save);
// could also
m = Report(bsf)[Outline Box("Bootstrap Forest for ?"), Outline Box("Column Contributions"), Table Box(1)] << get;
If you just want the columns, you can build it from the resulting list or
m = Report(bsf)[Outline Box("Bootstrap Forest for ?"), Outline Box("Column Contributions"), Table Box(1), StringColBox("Term")] << Copy Column;Re: How to copy the list of column contributions of a random forest using a script?I still didn't succeed with my own actual data.
dt=Current Data Table();for(i=5,i<=ncol(dt),i++,if(Column(i)<<GET name="=" xx=""></GET>

Re: How to copy the list of column contributions of a random forest using a script?I use the Chinese version of JMP, but it is feasible to run this code.
dt = Open( "$SAMPLE_DATA/Diabetes.jmp" );
cNa=dt<<GET column="" names=""></GET>
Re: How to copy the list of column contributions of a random forest using a script?Notice a difference between our scripts?
查看更多......I'm using different outline box name than you are as I'm using wild card ? on purpose to replace the column name
You could possibly skip the first outline box reference and it should still work.