[apps/regression] Add escape case if data is not suitable for regression

Change-Id: Ie2e028a5030e1b0d3f133efdde971645d5b4687b
This commit is contained in:
Hugo Saint-Vignes
2020-10-23 17:37:48 +02:00
committed by Émilie Feral
parent b2d7ee800a
commit f58633b03c

View File

@@ -349,7 +349,12 @@ double Store::computeDeterminationCoefficient(int series, Poincare::Context * gl
const int numberOfPairs = numberOfPairsOfSeries(series);
for (int k = 0; k < numberOfPairs; k++) {
// Difference between the observation and the estimated value of the model
double residual = m_data[series][1][k] - yValueForXValue(series, m_data[series][0][k], globalContext);
double evaluation = yValueForXValue(series, m_data[series][0][k], globalContext);
if (std::isnan(evaluation) || std::isinf(evaluation)) {
// Data Not Suitable for evaluation
return NAN;
}
double residual = m_data[series][1][k] - evaluation;
ssr += residual * residual;
// Difference between the observation and the overall observations mean
double difference = m_data[series][1][k] - mean;