SplitRowsTransform

Package: Libraries.Compute.Statistics.Transforms · Inherits from: Libraries.Language.Object, Libraries.Compute.Statistics.DataFrameTransform

The SplitRowsTransform class takes a data frame and transforms it into two DataFrames with copies of all of the data inside them. Specifically, you can set a percentage of the total data, like 0.8 for 80%, which then instructs the transform to select 80% of the rows, randomly, and place it into one DataFrame copy, with the remainder going in the other. This operation is synchronized across all columns so that it is the same split everywhere.

Example Code

DataFrame frame
frame:LoadFromCommaSeparatedValue(
"Hello, Hi
0, 17
1, 19
2, 21
3, 23
4, 25
5, 27
6, 29
7, 31
8, 33
9, 35
10, 35"
)

frame:AddSelectedColumn(0)
frame:AddSelectedColumn(1)

SplitRowsTransform transform
DataFrame in = transform:Transform(frame)
DataFrame out = transform:GetRemainderFrame()
output in:ToText()
output out:ToText()

Actions

GetHasRandomSeed()

Determines whether or not this class takes a seed for the random number generator into account.

Returns

boolean

GetPercent()

Gets the total percentage of the DataFrame to randomly select.

Returns

number

GetRemainderFrame()

This action provides the DataFrame for the remainder of the data set.

Returns

Libraries.Compute.Statistics.DataFrame

GetResultFrames()

This action returns the resulting operations two frames. The first index of the array is the frame with the percentage indicated in the system. The second index of the array is the remainder frame. This action should only be called after Transform is called, otherwise it will return an empty array.

Returns

Libraries.Containers.Array<Libraries.Compute.Statistics.DataFrame>

GetSeed()

Returns the seed for the random number generator. This seed is only used if GetHasRandomSeed() = true.

Returns

number

GetSelectedFrame()

This action provides the DataFrame for the content selected.

Returns

Libraries.Compute.Statistics.DataFrame

SetHasRandomSeed(boolean hasRandomSeed)

Sets whether or not this class takes a seed for the random number generator into account. If true, then it does.

Parameters

  • hasRandomSeed boolean

SetPercent(number percent)

Sets the total percentage of the DataFrame to randomly select.

Parameters

  • percent number

SetSeed(number seed)

Sets the random seed for the random number generator. As a convenience, this action also tells the class to use the random number generator seed. If this is not the desired behavior, call SetHasRandomSeed(false) on the transform. Calling this action is not necessary if no seed is desired.

Parameters

  • seed number

Transform(Libraries.Compute.Statistics.DataFrame frame)

Parameters

Returns

Libraries.Compute.Statistics.DataFrame

Inherited Actions

1 action from Libraries.Compute.Statistics.DataFrameTransform
3 actions from Libraries.Language.Object