SiaNet/Data/DataFrameIter.cs
/// <summary>
/// Splits the current dataset to train and test.
/// </summary>
/// <param name="testDataSize">Size of the test data.</param>
/// <returns></returns>
Splits the current dataset to train and test.
Splits the current dataset to train and test .
public (DataFrameIter, DataFrameIter) Split(double testDataSize = 0.33f)
        {
            long trainSize = Convert.ToInt64(frameX.Shape[0] * (1 - testDataSize));
            var trainX = frameX[new NDArray(new int[] { 0, (int)trainSize })];
            var valX = frameX[new NDArray(new int[] { (int)trainSize + 1, (int)frameX.Shape[0] - 1 })];
            var trainY = frameY[new NDArray(new int[] { 0, (int)trainSize })];
            var valY = frameY[new NDArray(new int[] { (int)trainSize + 1, (int)frameX.Shape[0] - 1 })];
            return (new DataFrameIter(trainX, trainY), new DataFrameIter(valX, valY));
        }
public ( DataFrameIter , DataFrameIter ) Split ( double testDataSize = 0.33f ) { long trainSize = Convert . ToInt64 ( frameX . Shape [ 0 ] * ( 1 - testDataSize ) ) ; var trainX = frameX [ new NDArray ( new int [ ] { 0 , ( int ) trainSize } ) ] ; var valX = frameX [ new NDArray ( new int [ ] { ( int ) trainSize + 1 , ( int ) frameX . Shape [ 0 ] - 1 } ) ] ; var trainY = frameY [ new NDArray ( new int [ ] { 0 , ( int ) trainSize } ) ] ; var valY = frameY [ new NDArray ( new int [ ] { ( int ) trainSize + 1 , ( int ) frameX . Shape [ 0 ] - 1 } ) ] ; return ( new DataFrameIter ( trainX , trainY ) , new DataFrameIter ( valX , valY ) ) ; }
Splits the current dataset to train and test.
Splits the current dataset to train and test .
None
testDataSize
double
Size of the test data.
Size of the test data .