Fix ShuffleData() implementation errors.
This commit is contained in:
@@ -69,7 +69,9 @@ void ShuffleData(const MatType& inputPoints,
|
||||
|
||||
outputPoints = MatType(locations, values, inputPoints.n_rows,
|
||||
inputPoints.n_cols, true);
|
||||
outputLabels = inputLabels.cols(ordering);
|
||||
outputLabels.set_size(inputLabels.n_elem);
|
||||
for (size_t i = 0; i < inputLabels.n_elem; ++i)
|
||||
outputLabels[ordering[i]] = inputLabels[i];
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
|
||||
@@ -609,7 +609,7 @@ BOOST_AUTO_TEST_CASE(ShuffleTest)
|
||||
arma::Row<size_t> counts(10, arma::fill::zeros);
|
||||
for (size_t i = 0; i < 10; ++i)
|
||||
{
|
||||
BOOST_REQUIRE_EQUAL((size_t) outputData(0, i), labels[i]);
|
||||
BOOST_REQUIRE_EQUAL((size_t) outputData(0, i), outputLabels[i]);
|
||||
BOOST_REQUIRE_SMALL(outputData(1, i), 1e-5);
|
||||
BOOST_REQUIRE_SMALL(outputData(2, i), 1e-5);
|
||||
counts[labels[i]]++;
|
||||
@@ -645,7 +645,7 @@ BOOST_AUTO_TEST_CASE(SparseShuffleTest)
|
||||
arma::Row<size_t> counts(10, arma::fill::zeros);
|
||||
for (size_t i = 0; i < 10; ++i)
|
||||
{
|
||||
BOOST_REQUIRE_EQUAL((size_t) outputData(0, i), labels[i]);
|
||||
BOOST_REQUIRE_EQUAL((size_t) outputData(0, i), outputLabels[i]);
|
||||
BOOST_REQUIRE_SMALL((double) outputData(1, i), 1e-5);
|
||||
BOOST_REQUIRE_SMALL((double) outputData(2, i), 1e-5);
|
||||
counts[labels[i]]++;
|
||||
|
||||
Reference in New Issue
Block a user