[apps/reg] Do not show "Yprediction given x" if not available

This commit is contained in:
Léa Saviot
2018-06-08 15:47:23 +02:00
committed by Émilie Feral
parent 94d21fb96a
commit 4b8462ed8a
15 changed files with 63 additions and 14 deletions

View File

@@ -32,10 +32,19 @@ double ExponentialModel::evaluate(double * modelCoefficients, double x) const {
return a*exp(b*x);
}
bool ExponentialModel::levelSetAvailable(double * modelCoefficients) const {
double a = modelCoefficients[0];
double b = modelCoefficients[1];
if (a == 0 || b == 0) {
return false;
}
return true;
}
double ExponentialModel::levelSet(double * modelCoefficients, double y) const {
double a = modelCoefficients[0];
double b = modelCoefficients[1];
if (a == 0 || b == 0 || y/a <= 0) {
if (!levelSetAvailable(modelCoefficients) || y/a <= 0) {
return NAN;
}
return log(y/a)/b;