/// Tests that the /// <see cref="NumericalBlock. /// GetNumericalBlocks(DoubleMatrix, DoubleMatrix)"/> /// method terminates successfully as expected when /// its parameters are valid and the data length is 1. /// </summary> public static void DataLengthIsOne() { var numericalData = DoubleMatrix.Dense(1, 1, -1); var targetData = DoubleMatrix.Dense(1, 1, 10); var blocks = NumericalBlock.GetNumericalBlocks( numericalData, targetData); NumericalBlockAssert.IsStateAsExpected( target: blocks[0], expectedFirstPosition: 0, expectedLastPosition: 0, expectedFirstValue: -1, expectedLastValue: -1, expectedTargetFrequencyDistribution: new Dictionary <double, int>(1) { { 10, 1 } }); }
/// Tests that the /// <see cref="NumericalBlock. /// GetNumericalBlocks(DoubleMatrix, DoubleMatrix)"/> /// method terminates successfully as expected when /// its parameters are valid and the data length is /// greater than 1. /// </summary> public static void DataLengthIsGreaterThanOne() { var numericalData = DoubleMatrix.Dense(7, 1, new double[7] { 1, 1, 1, 2, 2, 3, 4 }); var targetData = DoubleMatrix.Dense(7, 1, new double[7] { 10, 10, 10, 10, 10, 10, 5 }); var blocks = NumericalBlock.GetNumericalBlocks( numericalData, targetData); NumericalBlockAssert.IsStateAsExpected( target: blocks[0], expectedFirstPosition: 0, expectedLastPosition: 5, expectedFirstValue: 1, expectedLastValue: 3, expectedTargetFrequencyDistribution: new Dictionary <double, int>(2) { { 5, 0 }, { 10, 6 } }); NumericalBlockAssert.IsStateAsExpected( target: blocks[1], expectedFirstPosition: 6, expectedLastPosition: 6, expectedFirstValue: 4, expectedLastValue: 4, expectedTargetFrequencyDistribution: new Dictionary <double, int>(2) { { 5, 1 }, { 10, 0 } }); }
/// Tests that the /// <see cref="NumericalBlock. /// GetNumericalBlocks(DoubleMatrix, DoubleMatrix)"/> /// method terminates successfully as expected when /// its parameters are valid and a final cut point exists. /// </summary> public static void FinalCutPointExists() { var numericalData = DoubleMatrix.Dense(5, 1, new double[5] { -1, -1, 1, 1, 2 }); var targetData = DoubleMatrix.Dense(5, 1, new double[5] { 10, 20, 10, 10, 10 }); var blocks = NumericalBlock.GetNumericalBlocks( numericalData, targetData); NumericalBlockAssert.IsStateAsExpected( target: blocks[0], expectedFirstPosition: 0, expectedLastPosition: 1, expectedFirstValue: -1, expectedLastValue: -1, expectedTargetFrequencyDistribution: new Dictionary <double, int>(2) { { 10, 1 }, { 20, 1 } }); NumericalBlockAssert.IsStateAsExpected( target: blocks[1], expectedFirstPosition: 2, expectedLastPosition: 4, expectedFirstValue: 1, expectedLastValue: 2, expectedTargetFrequencyDistribution: new Dictionary <double, int>(1) { { 10, 3 }, { 20, 0 } }); }