From 0e81b16bdbf7dd172f44185cdf084afdbdd5e74e Mon Sep 17 00:00:00 2001 From: Rishabh Garg <56191449+RishabhGarg108@users.noreply.github.com> Date: Sun, 14 Mar 2021 08:41:15 +0530 Subject: [PATCH] Changed variables to camel case --- src/mlpack/tests/split_data_test.cpp | 58 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/mlpack/tests/split_data_test.cpp b/src/mlpack/tests/split_data_test.cpp index 075347bd3a..4ef35924c0 100644 --- a/src/mlpack/tests/split_data_test.cpp +++ b/src/mlpack/tests/split_data_test.cpp @@ -223,9 +223,9 @@ TEST_CASE("ZeroRatioStratifiedSplitData", "[SplitDataTest]") // Set the labels to 5 0s and 10 1s. const Row labels = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - const double test_ratio = 0; + const double testRatio = 0; - const auto value = Split(input, labels, test_ratio, false, true); + const auto value = Split(input, labels, testRatio, false, true); REQUIRE(std::get<0>(value).n_cols == 15); REQUIRE(std::get<1>(value).n_cols == 0); REQUIRE(std::get<2>(value).n_cols == 15); @@ -242,9 +242,9 @@ TEST_CASE("TotalRatioStratifiedSplitData", "[SplitDataTest]") // Set the labels to 5 0s and 10 1s. const Row labels = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - const double test_ratio = 1; + const double testRatio = 1; - const auto value = Split(input, labels, test_ratio, false, true); + const auto value = Split(input, labels, testRatio, false, true); REQUIRE(std::get<0>(value).n_cols == 0); REQUIRE(std::get<1>(value).n_cols == 15); REQUIRE(std::get<2>(value).n_cols == 0); @@ -263,9 +263,9 @@ TEST_CASE("StratifiedSplitDataResultTest", "[SplitDataTest]") const Row labels = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; - const double test_ratio = 0.25; + const double testRatio = 0.25; - const auto value = Split(input, labels, test_ratio, true, true); + const auto value = Split(input, labels, testRatio, true, true); REQUIRE(static_cast(find(std::get<2>(value) == 0)).n_rows == 3); REQUIRE(static_cast(find(std::get<2>(value) == 1)).n_rows == 6); REQUIRE(static_cast(find(std::get<2>(value) == 2)).n_rows == 9); @@ -293,22 +293,22 @@ TEST_CASE("StratifiedSplitLargerDataResultTest", "[SplitDataTest]") input.randu(); // 256 0s, 128 1s, 64 2s and 32 3s. - Row zero_label(256); - Row one_label(128); - Row two_label(64); - Row three_label(32); + Row zeroLabel(256); + Row oneLabel(128); + Row twoLabel(64); + Row threeLabel(32); - zero_label.fill(0); - one_label.fill(1); - two_label.fill(2); - three_label.fill(3); + zeroLabel.fill(0); + oneLabel.fill(1); + twoLabel.fill(2); + threeLabel.fill(3); - Row labels = arma::join_rows(zero_label, one_label); - labels = arma::join_rows(labels, two_label); - labels = arma::join_rows(labels, three_label); - const double test_ratio = 0.3; + Row labels = arma::join_rows(zeroLabel, oneLabel); + labels = arma::join_rows(labels, twoLabel); + labels = arma::join_rows(labels, threeLabel); + const double testRatio = 0.3; - const auto value = Split(input, labels, test_ratio, false, true); + const auto value = Split(input, labels, testRatio, false, true); REQUIRE(static_cast(find(std::get<2>(value) == 0)).n_rows == 180); REQUIRE(static_cast(find(std::get<2>(value) == 1)).n_rows == 90); REQUIRE(static_cast(find(std::get<2>(value) == 2)).n_rows == 45); @@ -334,9 +334,9 @@ TEST_CASE("StratifiedSplitRunTimeErrorTest", "[SplitDataTest]") input.randu(); labels.randu(); - const double test_ratio = 0.3; + const double testRatio = 0.3; - REQUIRE_THROWS_AS(Split(input, labels, test_ratio, false, true), + REQUIRE_THROWS_AS(Split(input, labels, testRatio, false, true), std::runtime_error); } @@ -380,12 +380,12 @@ TEST_CASE("SplitMatrixLabeledData", "[SplitDataTest]") REQUIRE(std::get<2>(value).n_cols == 8); REQUIRE(std::get<3>(value).n_cols == 2); - mat input_concat = arma::join_rows(std::get<0>(value), std::get<1>(value)); - mat labels_concat = arma::join_rows(std::get<2>(value), std::get<3>(value)); + mat inputConcat = arma::join_rows(std::get<0>(value), std::get<1>(value)); + mat labelsConcat = arma::join_rows(std::get<2>(value), std::get<3>(value)); // Order matters here. - CheckMatrices(input, input_concat); - CheckMatrices(labels, labels_concat); + CheckMatrices(input, inputConcat); + CheckMatrices(labels, labelsConcat); } /** @@ -414,10 +414,10 @@ TEST_CASE("SplitLabeledDataResultField", "[SplitDataTest]") REQUIRE(std::get<2>(value).n_cols == 1); // Train label. REQUIRE(std::get<3>(value).n_cols == 1); // Test label. - field input_concat = {std::get<0>(value)(0), std::get<1>(value)(0)}; - field label_concat = {std::get<2>(value)(0), std::get<3>(value)(0)}; + field inputConcat = {std::get<0>(value)(0), std::get<1>(value)(0)}; + field labelConcat = {std::get<2>(value)(0), std::get<3>(value)(0)}; // Order matters here. - CheckFields(input, input_concat); - CheckFields(label, label_concat); + CheckFields(input, inputConcat); + CheckFields(label, labelConcat); }