-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_model_metrics.cc
44 lines (37 loc) · 1.31 KB
/
test_model_metrics.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* Copyright (C) 2018 Swift Navigation Inc.
* Contact: Swift Navigation <[email protected]>
*
* This source is subject to the license found in the file 'LICENSE' which must
* be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/
#include "test_models.h"
#include <albatross/GP>
#include <albatross/Tune>
#include <gtest/gtest.h>
namespace albatross {
template <typename TestMetric>
class ModelMetricTester : public ::testing::Test {
public:
TestMetric test_metric;
};
/*
* Add any new model metrics here:
*/
typedef ::testing::Types<LeaveOneOutLikelihood<JointDistribution>,
LeaveOneOutLikelihood<MarginalDistribution>,
LeaveOneOutRMSE, GaussianProcessNegativeLogLikelihood>
MetricsToTest;
TYPED_TEST_SUITE(ModelMetricTester, MetricsToTest);
TYPED_TEST(ModelMetricTester, test_sanity) {
MakeGaussianProcess test_case;
auto dataset = test_case.get_dataset();
auto model = test_case.get_model();
const auto metric = this->test_metric(dataset, model);
EXPECT_FALSE(std::isnan(metric));
}
} // namespace albatross