cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
scott1588
Level IV

Customize Column Name for Save Predicteds Column

The following code launches the Bivariate platform and then saves predicted values in a column. This works fine. However, I would like to customize the column name for the save predicteds column. The Scripting Guide suggests sending nested messages but I can't seem to get that to work.

 

So the questions are...

 

1) Is it possible to customize the name of the Save Predicteds column within the platform options?

2) If not, how do I capture the name so I can customize it is subesquent steps?

 

Thanks much for any assistance anyone can provide.

 

Names Default to Here(1);


// SETUP
dt2 = New Table( "Interpolated Data",
	Add Rows( 60 ),
	New Column( "Timestamp",
		Numeric,
		"Continuous",
		Format( "m/d/y h:m", 19 ),
		Input Format( "m/d/y h:m" ),
		Set Values(
			[3742070400, 3742070460, 3742070520, 3742070580, 3742070640, 3742070700,
			3742070760, 3742070820, 3742070880, 3742070940, 3742071000, 3742071060,
			3742071120, 3742071180, 3742071240, 3742071300, 3742071360, 3742071420,
			3742071480, 3742071540, 3742071600, 3742071660, 3742071720, 3742071780,
			3742071840, 3742071900, 3742071960, 3742072020, 3742072080, 3742072140,
			3742072200, 3742072260, 3742072320, 3742072380, 3742072440, 3742072500,
			3742072560, 3742072620, 3742072680, 3742072740, 3742072800, 3742072860,
			3742072920, 3742072980, 3742073040, 3742073100, 3742073160, 3742073220,
			3742073280, 3742073340, 3742073400, 3742073460, 3742073520, 3742073580,
			3742073640, 3742073700, 3742073760, 3742073820, 3742073880, 3742073940]
		),
		Set Display Width( 250 )
	),
	New Column( "Data",
		Numeric,
		"Continuous",
		Format( "Best", 15 ),
		Set Values(
			[899.08410644531295, ., ., ., ., ., ., ., 897.38671875, ., ., ., ., ., .,
			., 898.518310546875, ., ., ., ., ., ., ., 897.57525634765602, ., ., ., .,
			., ., ., 897.38671875, ., ., ., ., ., ., ., 896.63226318359398, ., ., .,
			., ., ., ., 896.25506591796898, ., ., ., ., ., ., ., 896.44366455078102,
			., ., .]
		),
		Set Display Width( 250 )
	)
);



// RUN PLATFORM
// QUESTION 1: Is it possible to customize the name of the Save Predicteds column within the platform options?
// QUESTION 2: If not, how do I capture the name so I can customize it is subesquent steps?

dt2 << Bivariate( Y( :Data ) , X( :Timestamp ), Fit Spline( 1e-15, {Save Predicteds} ), Invisible );
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Customize Column Name for Save Predicteds Column

The simple method that I would use is:

predictedName = Column( dt2, N Cols( dt2 ) ) << get name;
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Customize Column Name for Save Predicteds Column

The simple method that I would use is:

predictedName = Column( dt2, N Cols( dt2 ) ) << get name;
Jim
scott1588
Level IV

Re: Customize Column Name for Save Predicteds Column

Jim,

 

I didn't think about that. The platform will always dump the predicteds at the end of the table so it will always be the last column.

 

Perfect and simple.

 

Thanks much.

 

jthi
Super User

Re: Customize Column Name for Save Predicteds Column

A bit more generic option is to utilize associative arrays. For example if you fit models to multiple Y at the same time, you will end up with multiple columns

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

original_columns = dt << Get Column Names("String");

obj = dt << Neural(
	Y(:Y, :BMI),
	X(:Age, :BP, :Total Cholesterol, :LDL, :HDL, :TCH, :LTG, :Glucose),
	Go
);
obj << Save Formulas;
obj << Close Window;

new_columns = Associative Array(dt << Get Column Names("String"));
new_columns << Remove(Associative Array(original_columns));
new_columns = new_columns << get keys; // Note that these are in alphabetical order
// If the order causes issues, it can be mitigated with some tricks

// This will rename also the hidden layers which could potentially cause issues For Each({colname}, new_columns, Column(dt, colname) << Set Name((dt << get name) || " " || colname); );
-Jarmo