Commit 08900c91 authored by fbourgin's avatar fbourgin
Browse files

wip - add a test

parent 5adc574d
1 merge request!9Resolve "evaluation of quantiles prediction"
Pipeline #63418 failed with stage
in 45 seconds
Showing with 35 additions and 0 deletions
+35 -0
...@@ -297,6 +297,41 @@ TEST(ProbabilistTests, TestIntervals) ...@@ -297,6 +297,41 @@ TEST(ProbabilistTests, TestIntervals)
} }
} }
TEST(ProbabilistTests, TestIntervalsQLVL)
{
// read in data
xt::xtensor<double, 1> observed;
xt::xtensor<double, 2> predicted;
std::tie(observed, predicted) = load_data_p();
// read in expected results
auto expected = load_expected_p();
// compute scores
std::vector<std::string> metrics = {"CR"};
std::vector<xt::xarray<double>> results =
evalhyd::evalp(
// shape: (sites [1], time [t])
xt::eval(xt::view(observed, xt::newaxis(), xt::all())),
// shape: (sites [1], lead times [1], members [m], time [t])
xt::eval(xt::view(predicted, xt::newaxis(), xt::newaxis(), xt::range(0, 4), xt::all())),
metrics,
xt::xtensor<double, 2>({}),
"", // events
{50., 80.}, // c_lvl
{0.1, 0.25, 0.75, 0.9} // q_lvl
);
// check results
for (std::size_t m = 0; m < metrics.size(); m++)
{
EXPECT_TRUE(xt::all(xt::isclose(
results[m], expected[metrics[m]], 1e-05, 1e-08, true
))) << "Failure for (" << metrics[m] << ")";
}
}
TEST(ProbabilistTests, TestMultiVariate) TEST(ProbabilistTests, TestMultiVariate)
{ {
// read in data // read in data
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment