solving issue with robust model
parent
001a55ad3a
commit
73600c8faa
|
|
@ -339,11 +339,21 @@ template <typename T>
|
|||
static double Kappa(const BinaryMeasurement<T> &measurement) {
|
||||
const auto &isotropic = boost::dynamic_pointer_cast<noiseModel::Isotropic>(
|
||||
measurement.noiseModel());
|
||||
if (!isotropic) {
|
||||
double sigma;
|
||||
if (isotropic) {
|
||||
sigma = isotropic->sigma();
|
||||
} else{
|
||||
const auto &robust = boost::dynamic_pointer_cast<noiseModel::Robust>(
|
||||
measurement.noiseModel());
|
||||
if (robust) {
|
||||
std::cout << "Verification of optimality does not work with robust cost function" << std::endl;
|
||||
sigma = 1; // setting arbitrary value
|
||||
}else{
|
||||
throw std::invalid_argument(
|
||||
"Shonan averaging noise models must be isotropic.");
|
||||
"Shonan averaging noise models must be isotropic (but robust losses are allowed).");
|
||||
|
||||
}
|
||||
}
|
||||
const double sigma = isotropic->sigma();
|
||||
return 1.0 / (sigma * sigma);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ TEST(ShonanAveraging2, noisyToyGraphWithHuber) {
|
|||
graph.print();
|
||||
EXPECT_LONGS_EQUAL(6, graph.size());
|
||||
auto initial = shonan.initializeRandomly(kRandomNumberGenerator);
|
||||
auto result = shonan.run(initial, 2);
|
||||
auto result = shonan.run(initial, 2, 3);
|
||||
EXPECT_DOUBLES_EQUAL(0.0008211, shonan.cost(result.first), 1e-6);
|
||||
EXPECT_DOUBLES_EQUAL(0, result.second, 1e-10); // certificate!
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue