/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/cpp/linear_regression/linear_model.h
42 строки
882 B
qkrorlqr
Initial NBS OpenSource export
28 апр 2023, 21:54
28 апр 2023, 21:54
783a858
Код
Авторство
О чём код?
#pragma once #include <util/generic/algorithm.h> #include <util/generic/vector.h> #include <util/ysaveload.h> #include <utility> class TLinearModel { private: TVector<double> Coefficients; double Intercept; public: Y_SAVELOAD_DEFINE(Coefficients, Intercept); TLinearModel(TVector<double>&& coefficients, const double intercept) : Coefficients(std::move(coefficients)) , Intercept(intercept) { } explicit TLinearModel(size_t featuresCount = 0) : Coefficients(featuresCount) , Intercept(0.) { } const TVector<double>& GetCoefficients() const { return Coefficients; } double GetIntercept() const { return Intercept; } template <typename T> double Prediction(const TVector<T>& features) const { return InnerProduct(Coefficients, features, Intercept); } };