MLPACK  1.0.11
linear_regression.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_METHODS_LINEAR_REGRESSION_LINEAR_REGRESSION_HPP
24 #define __MLPACK_METHODS_LINEAR_REGRESSION_LINEAR_REGRESSION_HPP
25 
26 #include <mlpack/core.hpp>
27 
28 namespace mlpack {
29 namespace regression {
30 
37 {
38  public:
47  LinearRegression(const arma::mat& predictors,
48  const arma::vec& responses,
49  const double lambda = 0,
50  const bool intercept = true,
51  const arma::vec& weights = arma::vec()
52  );
53 
59  LinearRegression(const std::string& filename);
60 
66  LinearRegression(const LinearRegression& linearRegression);
67 
72 
79  void Predict(const arma::mat& points, arma::vec& predictions) const;
80 
98  double ComputeError(const arma::mat& points,
99  const arma::vec& responses) const;
100 
102  const arma::vec& Parameters() const { return parameters; }
104  arma::vec& Parameters() { return parameters; }
105 
107  double Lambda() const { return lambda; }
109  double& Lambda() { return lambda; }
110 
111  // Returns a string representation of this object.
112  std::string ToString() const;
113 
114  private:
119  arma::vec parameters;
124  double lambda;
126  bool intercept;
127 };
128 
129 }; // namespace linear_regression
130 }; // namespace mlpack
131 
132 #endif // __MLPACK_METHODS_LINEAR_REGRESSCLIN_HPP