Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
lwx228
Level VII

How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

Missing formula with data with missing value trained by Partition model, how to convert JSL into a form that can be used in JMP formula.

ab>=-14&P1>=174.1&EVk<34341 or Missing&xyz<214.98 or Missing&EVk<154 or Missing&P1>=1741

into

 :ab >= -14 & :P1 >= 1741 & (:EVk < 154 | Is Missing( :EVk )) & (:xyz < 214.98 | Is Missing( :xyz )) 

Thanks!

16 REPLIES 16
Highlighted
lwx228
Level VII

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

Here "AB", "P1" and "EVk" are Partition multiple times.How do can keep only valid parameters?

 

And how do automatically turn

"EVk<154 or Missing"

into

":EVk<154 | is Missing(:EVk)"?

Highlighted

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

Just save the prediction formula as a column formula after selecting the partition model.

Learn it once, use it forever!
Highlighted

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

So if you save the fitted partition model, it IS a column formula.

Learn it once, use it forever!
Highlighted
lwx228
Level VII

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

Thank markbailey!
But I have tried to copy the leaf label formula and calculate it as a normal formula, which is wrong.
For example:

dt<<New Column("text",formula(:ab>=-14&:P1>=1741&:xyz<214.98 or Missing&:EVk<154 or Missing));dt<<run formulas;Column("text")<<deleteFormula;Wait(0);

 

 

2020-06-11_22-43.png 

Highlighted

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

Yes, that code is wrong. That code is not what is saved as a formula for the leaf labels. You incorrectly copied what you want from the formula and pasted the wrong code into your script.

 

Here is an example that copied the saved formula for the leaf labels verbatim and pasted it as the argument to the Formula() argument for the new column:

Names Default To Here( 1 );

// open an example
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// create a new column for character data and populate it with formula based on a
// previously saved formula for leaf labels.
dt << New Column( "Text",
	Character,
	Formula(
		If( !Is Missing( :height ) & :height >= 63,
			If( !Is Missing( :height ) & :height >= 67,
				"height>=63&height>=67",
				"height>=63&height<67"
			),
			"height<63"
		)
	)
);
Learn it once, use it forever!
Highlighted
lwx228
Level VII

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

yes.I also know that can use the "prediction formula" directly.But this prediction formula is so global, so large, and so complex that it is inconvenient to use it in other files.
The "leaf label formula" is accurate, but the leaf label formula produced automatically by the "Partition" model cannot be used directly.

So I transferred these leaf label formulas to Excel using VBA to automatically convert them into a form that can be used in JMP formulas.


But this operation will use the whole process of operation can not be fully automated.

 

 

Thank markbailey!

Highlighted
lwx228
Level VII

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

So I want to know how to use JSL to convert these leaf label formulas into the usable form of JMP formula() formu.
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

I think we're confused because the Leaf Label Formula column already has a formula behind it. You don't need to convert anything. Can you explain more clearly exactly the steps you want to do?

 

LeafLabelFormula.gif

-Jeff
Highlighted
lwx228
Level VII

Re: How to use JSL to convert the Decision Tree Partition Leaf Label Formula into a form that can be used in JMP formula?

Thank Jeff!


Since I got these leaf label formulas that were not used in the original file.


So I simply removed the formula from the leaf label formula column, got only the text, and lumped the text of the different leaf label formulas into a file.


These textual leaf label formulas are then used to calculate other data using JSL.So I have this problem of conversion.

Article Labels