MCPcopy Create free account
hub / github.com/catboost/catboost / SumSquaredErrors

Function SumSquaredErrors

library/cpp/linear_regression/linear_regression.cpp:307–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305 }
306
307 double SumSquaredErrors(const TVector<double>& olsMatrix,
308 const TVector<double>& olsVector,
309 const TVector<double>& solution,
310 const double goalsDeviation) {
311 const size_t featuresCount = olsVector.size();
312
313 double sumSquaredErrors = goalsDeviation;
314 size_t olsMatrixElementIdx = 0;
315 for (size_t i = 0; i < featuresCount; ++i) {
316 sumSquaredErrors += olsMatrix[olsMatrixElementIdx] * solution[i] * solution[i];
317 ++olsMatrixElementIdx;
318 for (size_t j = i + 1; j < featuresCount; ++j) {
319 sumSquaredErrors += 2 * olsMatrix[olsMatrixElementIdx] * solution[i] * solution[j];
320 ++olsMatrixElementIdx;
321 }
322 sumSquaredErrors -= 2 * solution[i] * olsVector[i];
323 }
324 return sumSquaredErrors;
325 }
326
327#ifdef _sse2_
328 inline void AddFeaturesProduct(const double weight, const TVector<double>& features, TVector<double>& linearizedOLSTriangleMatrix) {

Callers 1

SumSquaredErrorsMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected