cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
ih
Super User (Alumni) ih
Super User (Alumni)

Opening 'Make validation Column' as hidden, or function for a stratified random sample

I feel like I'm missing something simple here, but is it possible to script the Make Validation Column platform without the window opening?  I was trying trying to use it to create stratified validation columns with grouping via a script.  Alternately, is there a column formula or function to create a stratified sample sample with groups?

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Opening 'Make validation Column' as hidden, or function for a stratified random sample

Is this the function you tried?

 

valid.PNG

View solution in original post

Re: Opening 'Make validation Column' as hidden, or function for a stratified random sample

If you create it interactively and choose "Formula" rather than "Fixed", you will see a formula like this:

Make Validation Formula( [0.75, 0.25, 0], <<Stratification Columns( :Y1 ) )

This is stratified by a column named Y1.

Dan Obermiller

View solution in original post

4 REPLIES 4

Re: Opening 'Make validation Column' as hidden, or function for a stratified random sample

Is this the function you tried?

 

valid.PNG

ih
Super User (Alumni) ih
Super User (Alumni)

Re: Opening 'Make validation Column' as hidden, or function for a stratified random sample

I don't believe that formula includes stratification, so instead I was trying this:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Lipid Data.jmp" );
dt << Make Validation Column(
	Stratification Columns( :Gender ),
	Training Set( 0.50 ),
	Validation Set( 0.25 ),
	Test Set( 0.25 ),
	New Column Name( "Valid1" ),
	Random Seed( 1234 ),
	Go
);

Re: Opening 'Make validation Column' as hidden, or function for a stratified random sample

If you create it interactively and choose "Formula" rather than "Fixed", you will see a formula like this:

Make Validation Formula( [0.75, 0.25, 0], <<Stratification Columns( :Y1 ) )

This is stratified by a column named Y1.

Dan Obermiller
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Opening 'Make validation Column' as hidden, or function for a stratified random sample

Ah ha, okay I apologize as it was setting a Random Seed that I couldn't get working with the Make Validation Formula.  The option to set a Random Seed disappears from the UI when selecting a formula.  But, I just found that Random Reset can solve this:

 

Names default to here(1);
dt = Open("$Sample_data/iris.jmp");

//Make a grouping Column
dt << New Column("Group", Numeric, "Nominal", Format("Best", 12), Formula(Floor((Row() - 1) / 5)));

random reset(10);
vals = transform each({r}, 1::nrow(dt), row() = r;
	Make Validation Formula(
		[0.75, 0.25, 0], 
		<<Stratification Columns( :Sepal length ),
		<<Grouping Columns( :Group )
	)
);
New Column("Validation with Grouping", Numeric, "Nominal", Format("Best", 12), Set Values(vals), Value Labels({0 = "Training", 1 = "Validation", 2 = "Test"}), Use Value Labels(1));