mlpack
Classes | Macros | Functions
preprocess_split_test.cpp File Reference
#include <mlpack/core.hpp>
#include <mlpack/core/util/mlpack_main.hpp>
#include <mlpack/methods/preprocess/preprocess_split_main.cpp>
#include "test_helper.hpp"
#include "../test_catch_tools.hpp"
#include "../catch.hpp"
#include <cmath>
Include dependency graph for preprocess_split_test.cpp:

Classes

struct  PreprocessSplitTestFixture
 

Macros

#define BINDING_TYPE   BINDING_TYPE_TEST
 

Functions

 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessSplitDimensionTest", "[PreprocessSplitMainTest][BindingTests]")
 Check that desired output dimensions are received for both input data and labels.
 
 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessSplitLabelLessDimensionTest", "[PreprocessSplitMainTest][BindingTests]")
 Check that desired output dimensions are received for the input data when labels are not provided.
 
 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessSplitTestRatioTest", "[PreprocessSplitMainTest][BindingTests]")
 Ensure that test ratio is always a non-negative number.
 
 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessSplitZeroTestRatioTest", "[PreprocessSplitMainTest][BindingTests]")
 Check that if test size is 0 then train consist of whole input data.
 
 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessSplitUnityTestRatioTest", "[PreprocessSplitMainTest][BindingTests]")
 Check that if test size is 1 then test consist of whole input data.
 
 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessSplitLabelShuffleDataTest", "[PreprocessSplitMainTest][BindingTests]")
 Check shuffle_data flag is working as expected.
 
 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessStratifiedSplitZeroTestRatioTest", "[PreprocessSplitMainTest][BindingTests]")
 Check that if test size is 0 then train consist of whole input data when stratifying.
 
 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessStratifiedSplitUnityTestRatioTest", "[PreprocessSplitMainTest][BindingTests]")
 Check that if test size is 1 then test consist of whole input data when stratifying.
 
 TEST_CASE_METHOD (PreprocessSplitTestFixture, "PreprocessStratifiedSplitTest", "[PreprocessSplitMainTest][BindingTests]")
 Checking label wise counts to ensure data is stratified when passing the stratify_data param. More...
 

Detailed Description

Author
Manish Kumar

Test mlpackMain() of preprocess_split_main.cpp.

mlpack is free software; you may redistribute it and/or modify it under the terms of the 3-clause BSD license. You should have received a copy of the 3-clause BSD license along with mlpack. If not, see http://www.opensource.org/licenses/BSD-3-Clause for more information.

Function Documentation

◆ TEST_CASE_METHOD()

TEST_CASE_METHOD ( PreprocessSplitTestFixture  ,
"PreprocessStratifiedSplitTest"  ,
""  [PreprocessSplitMainTest][BindingTests] 
)

Checking label wise counts to ensure data is stratified when passing the stratify_data param.

The vc2 dataset labels file contains 40 0s, 100 1s, and 67 2s. Considering a test ratio of 0.3, Number of 0s in the test set lables = 12 ( floor(40 * 0.3) = floor(12) ). Number of 1s in the test set labels = 30 ( floor(100 * 0.3) = floor(30) ). Number of 2s in the test set labels = 20 ( floor(67 * 0.3) = floor(20.1) ). Total points in the test set = 62 ( 12 + 30 + 20 ).