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

Method Add

library/cpp/linear_regression/linear_regression.cpp:25–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25bool TFastLinearRegressionSolver::Add(const TVector<double>& features, const double goal, const double weight) {
26 const size_t featuresCount = features.size();
27
28 if (LinearizedOLSMatrix.empty()) {
29 LinearizedOLSMatrix.resize((featuresCount + 1) * (featuresCount + 2) / 2);
30 OLSVector.resize(featuresCount + 1);
31 }
32
33 AddFeaturesProduct(weight, features, LinearizedOLSMatrix);
34
35 const double weightedGoal = goal * weight;
36 double* olsVectorElement = OLSVector.data();
37 for (const double feature : features) {
38 *olsVectorElement += feature * weightedGoal;
39 ++olsVectorElement;
40 }
41 *olsVectorElement += weightedGoal;
42
43 SumSquaredGoals += goal * goal * weight;
44
45 return true;
46}
47
48bool TLinearRegressionSolver::Add(const TVector<double>& features, const double goal, const double weight) {
49 const size_t featuresCount = features.size();

Callers 1

SolveMethod · 0.45

Calls 12

AddFeaturesProductFunction · 0.85
_mm_mul_pdFunction · 0.85
_mm_add_pdFunction · 0.85
_mm_set_pdFunction · 0.50
_mm_loadu_pdFunction · 0.50
_mm_storeu_pdFunction · 0.50
AddFunction · 0.50
sizeMethod · 0.45
emptyMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected