cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Feli
Level IV

Accessing Outline Box NIPALS Fit in JSL

I want to dynamically access the fit part of the PLS report ("NIPALS fit with x factors"). I know that I can access it if I know the number of the outline box (e.g., OutlineBox(6)) or the exact title, but since the number of the former could change and the latter changes depending on the number of factors, I have trouble dynamically accessing the outline box.

 

Is there a way of getting the tree position of a outline box by searching for part of its name?

2 ACCEPTED SOLUTIONS

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Accessing Outline Box NIPALS Fit in JSL

You could use xpath to search all outline boxes by name.

pls report << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");

Example:

names default to here(1);

dt = Open( "$Sample_data/iris.jmp" );

pls = Partial Least Squares(
	Y( :Petal width ),
	X( :Sepal length, :Sepal width, :Petal length ),
	Validation Method( KFold( 7 ), Initial Number of Factors( 3 ) ),
	Fit( Method( NIPALS ), Number of Factors( 3 ) ),
	Fit( Method( NIPALS ), Number of Factors( 2 ) )
);

//get all matching outline boxes:
ob = pls << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");

//Reference the first match:
ob[1] << Prepend ( Spacer Box( size( 800, 5 ), color( "red" ) ) );

View solution in original post

Feli
Level IV

Re: Accessing Outline Box NIPALS Fit in JSL

With the snippet

mywind=Window() << Get Window Title;

pls_wind = {};


For( i = 1, i <= N Items( mywind ), i++,

     If( Contains( mywind[i], "Partial Least Squares"),

           Insert Into( pls_wind, mywind[i] )

     )

);



ob = Window( pls_wind[1] )  << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");

I can access the PLS window and send messages, so that seems to work.

View solution in original post

4 REPLIES 4
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Accessing Outline Box NIPALS Fit in JSL

You could use xpath to search all outline boxes by name.

pls report << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");

Example:

names default to here(1);

dt = Open( "$Sample_data/iris.jmp" );

pls = Partial Least Squares(
	Y( :Petal width ),
	X( :Sepal length, :Sepal width, :Petal length ),
	Validation Method( KFold( 7 ), Initial Number of Factors( 3 ) ),
	Fit( Method( NIPALS ), Number of Factors( 3 ) ),
	Fit( Method( NIPALS ), Number of Factors( 2 ) )
);

//get all matching outline boxes:
ob = pls << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");

//Reference the first match:
ob[1] << Prepend ( Spacer Box( size( 800, 5 ), color( "red" ) ) );
Feli
Level IV

Re: Accessing Outline Box NIPALS Fit in JSL

@ih: When I try your way with my example, I get the error message:

Feli_0-1598336358905.png

I'm calling the PLS using

pls = Partial Least Squares(
	
		Validation( :Validation ),
		Initial Number of Factors( 15 ),
		Centering( 0 ),
		Scaling( 0 ),
		Fit(
			Method( NIPALS ), 
		
			Distance Plots( 1 ),
			Diagnostics Plots( 1 ),
			Overlay Loadings Plots( 1 ),
			VIP vs Coefficients Plots( 1 ),
			T Square Plot( 1 ),
			Correlation Loading Plot( 2 ),
			Overlay Coefficients Plots( 1 )
		)
			
	);
	

because I need the PLS dialog to prompt for X and Y.

txnelson
Super User

Re: Accessing Outline Box NIPALS Fit in JSL

It appears as if the "pls" pointer to the Partial Least Squares() platform gets lost when it has to pop up for X and Y input.  So below is a real kluge of a solution, that uses a reference to the name of the output window that will be produced for the example, and keeps checking to see when it appears, and then applies the red line.  I don't like the solution....hopefully another Community member has a better solution

Names Default To Here( 1 );

dt = Open( "$Sample_data/iris.jmp" );

pls = Partial Least Squares(
	Validation Method( KFold( 7 ), Initial Number of Factors( 3 ) ),
	Fit( Method( NIPALS ), Number of Factors( 3 ) ),
	Fit( Method( NIPALS ), Number of Factors( 2 ) )
);
ob = "";
counter = 0;
While( ob == "",
	Wait( 5 );
	ob = Try( Window( "iris - Partial Least Squares of Petal width" ) << XPath( "//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]" ), "" );
	Try( ob[1] << Prepend( Spacer Box( size( 800, 5 ), color( "red" ) ) ) );
);
Jim
Feli
Level IV

Re: Accessing Outline Box NIPALS Fit in JSL

With the snippet

mywind=Window() << Get Window Title;

pls_wind = {};


For( i = 1, i <= N Items( mywind ), i++,

     If( Contains( mywind[i], "Partial Least Squares"),

           Insert Into( pls_wind, mywind[i] )

     )

);



ob = Window( pls_wind[1] )  << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");

I can access the PLS window and send messages, so that seems to work.