You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_Classifier.hpp 2.0KB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ///-------------------------------------------------------------------------------------------------
  2. ///
  3. /// \file test_Classifier.hpp
  4. /// \brief Tests for Classifier Functions.
  5. /// \author Thibaut Monseigne (Inria).
  6. /// \version 1.0.
  7. /// \date 09/01/2019.
  8. /// \copyright <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU Affero General Public License v3.0</a>.
  9. ///
  10. ///-------------------------------------------------------------------------------------------------
  11. #pragma once
  12. #include "gtest/gtest.h"
  13. #include "misc.hpp"
  14. #include "init.hpp"
  15. #include <geometry/Classification.hpp>
  16. //---------------------------------------------------------------------------------------------------
  17. class Tests_Classifier : public testing::Test
  18. {
  19. protected:
  20. std::vector<std::vector<Eigen::RowVectorXd>> m_dataSet;
  21. void SetUp() override
  22. {
  23. const std::vector<Eigen::RowVectorXd> tmp = InitFeaturization::TangentSpace::Reference();
  24. m_dataSet = Geometry::Vector1DTo2D(tmp, { NB_TRIALS1, NB_TRIALS2 });
  25. }
  26. };
  27. //---------------------------------------------------------------------------------------------------
  28. //---------------------------------------------------------------------------------------------------
  29. TEST_F(Tests_Classifier, LSQR)
  30. {
  31. const Eigen::MatrixXd ref = InitClassif::LSQR::Reference();
  32. Eigen::MatrixXd calc;
  33. Geometry::LSQR(m_dataSet, calc);
  34. EXPECT_TRUE(isAlmostEqual(ref, calc)) << ErrorMsg("LSQR", ref, calc);
  35. }
  36. //---------------------------------------------------------------------------------------------------
  37. //---------------------------------------------------------------------------------------------------
  38. TEST_F(Tests_Classifier, FgDACompute)
  39. {
  40. const Eigen::MatrixXd ref = InitClassif::FgDACompute::Reference();
  41. Eigen::MatrixXd calc;
  42. Geometry::FgDACompute(m_dataSet, calc);
  43. EXPECT_TRUE(isAlmostEqual(ref, calc)) << ErrorMsg("FgDA", ref, calc);
  44. }
  45. //---------------------------------------------------------------------------------------------------