BookmarkSubscribeRSS Feed

JSL: how can you script make a validation column using stratified random

ghartel

Community Trekker

Joined:

Mar 5, 2017

I want to create a validation column using stratified random in JSL, but it doesn't seem to let me incldue the column name for stratification:

Make Validation Column(
	Training Set( 0.50 ),
	Validation Set( 0.25 ),
	Test Set( 0.25 ),
	Stratified Random(:Group)
);

 

this brings up a column selection dialog.  I cant find documentation how to specify the column in JSL code.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

I played around with the Make Validation Column object, and as you indicated, I could not make the Stratified Random work without having the column selection window come up.  However, I was able to add a By() element into the script and it may work for what you want:

Names Default To Here( 1 );
dt = Current Data Table();
dt << Make Validation Column(
	Training Set( 0.50 ),
	Validation Set( 0.25 ),
	Test Set( 0.25 ),
	formula random,
	by( :group )
);
Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

I played around with the Make Validation Column object, and as you indicated, I could not make the Stratified Random work without having the column selection window come up.  However, I was able to add a By() element into the script and it may work for what you want:

Names Default To Here( 1 );
dt = Current Data Table();
dt << Make Validation Column(
	Training Set( 0.50 ),
	Validation Set( 0.25 ),
	Test Set( 0.25 ),
	formula random,
	by( :group )
);
Jim
aronwilson

Community Trekker

Joined:

Jan 27, 2017

This worked great by the way. I was able to use this in a script to quickly general validation columns stratified by another column.