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

Class TLinearModel

library/cpp/linear_regression/linear_model.h:10–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include <utility>
9
10class TLinearModel {
11private:
12 TVector<double> Coefficients;
13 double Intercept;
14
15public:
16 Y_SAVELOAD_DEFINE(Coefficients, Intercept);
17
18 TLinearModel(TVector<double>&& coefficients, const double intercept)
19 : Coefficients(std::move(coefficients))
20 , Intercept(intercept)
21 {
22 }
23
24 explicit TLinearModel(size_t featuresCount = 0)
25 : Coefficients(featuresCount)
26 , Intercept(0.)
27 {
28 }
29
30 const TVector<double>& GetCoefficients() const {
31 return Coefficients;
32 }
33
34 double GetIntercept() const {
35 return Intercept;
36 }
37
38 template <typename T>
39 double Prediction(const TVector<T>& features) const {
40 return InnerProduct(Coefficients, features, Intercept);
41 }
42};

Callers 1

SolveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected