[mlpack] 64/149: Minor formatting fixes: tabs->spaces, etc.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Sat May 2 09:11:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch svn-trunk
in repository mlpack.
commit f420226a012f129d4dd7439e4b9732365f60aa98
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Mon Nov 3 16:22:28 2014 +0000
Minor formatting fixes: tabs->spaces, etc.
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17284 9d5b8971-822b-0410-80eb-d18c1038ef23
---
src/mlpack/core/dists/regression_distribution.cpp | 45 +++++++++++------------
src/mlpack/core/dists/regression_distribution.hpp | 34 ++++++++---------
2 files changed, 39 insertions(+), 40 deletions(-)
diff --git a/src/mlpack/core/dists/regression_distribution.cpp b/src/mlpack/core/dists/regression_distribution.cpp
index 32dc09b..39b29cc 100644
--- a/src/mlpack/core/dists/regression_distribution.cpp
+++ b/src/mlpack/core/dists/regression_distribution.cpp
@@ -13,8 +13,7 @@ using namespace mlpack::distribution;
/**
* Returns a string representation of this object.
*/
-std::string RegressionDistribution::ToString()
- const
+std::string RegressionDistribution::ToString() const
{
std::ostringstream convert;
convert << "HMMRegression [" << this << "]" << std::endl;
@@ -30,41 +29,41 @@ std::string RegressionDistribution::ToString()
}
/**
-* Estimate parameters using provided observation weights
-*
-* @param observations List of observations.
-*/
+ * Estimate parameters using provided observation weights
+ *
+ * @param observations List of observations.
+ */
void RegressionDistribution::Estimate(const arma::mat& observations)
{
- regression::LinearRegression lr(observations.rows(1, observations.n_rows-1),
+ regression::LinearRegression lr(observations.rows(1, observations.n_rows - 1),
(observations.row(0)).t(), 0, true);
rf = lr;
arma::vec fitted;
- lr.Predict(observations.rows(1, observations.n_rows-1), fitted);
- err.Estimate(observations.row(0)-fitted.t());
+ lr.Predict(observations.rows(1, observations.n_rows - 1), fitted);
+ err.Estimate(observations.row(0) - fitted.t());
}
/**
-* Estimate parameters using provided observation weights
-*
-* @param weights probability that given observation is from distribution
-*/
+ * Estimate parameters using provided observation weights.
+ *
+ * @param weights probability that given observation is from distribution
+ */
void RegressionDistribution::Estimate(const arma::mat& observations,
const arma::vec& weights)
{
- regression::LinearRegression lr(observations.rows(1, observations.n_rows-1),
+ regression::LinearRegression lr(observations.rows(1, observations.n_rows - 1),
(observations.row(0)).t(), 0, true, weights);
rf = lr;
arma::vec fitted;
- lr.Predict(observations.rows(1, observations.n_rows-1), fitted);
- err.Estimate(observations.row(0)-fitted.t(), weights);
+ lr.Predict(observations.rows(1, observations.n_rows - 1), fitted);
+ err.Estimate(observations.row(0) - fitted.t(), weights);
}
/**
-* Evaluate probability density function of given observation
-*
-* @param observation point to evaluate probability at
-*/
+ * Evaluate probability density function of given observation.
+ *
+ * @param observation point to evaluate probability at
+ */
double RegressionDistribution::Probability(const arma::vec& observation) const
{
arma::vec fitted;
@@ -73,7 +72,7 @@ double RegressionDistribution::Probability(const arma::vec& observation) const
}
void RegressionDistribution::Predict(const arma::mat& points,
- arma::vec& predictions) const
+ arma::vec& predictions) const
{
- rf.Predict(points, predictions);
-}
\ No newline at end of file
+ rf.Predict(points, predictions);
+}
diff --git a/src/mlpack/core/dists/regression_distribution.hpp b/src/mlpack/core/dists/regression_distribution.hpp
index b236aa0..af13acb 100644
--- a/src/mlpack/core/dists/regression_distribution.hpp
+++ b/src/mlpack/core/dists/regression_distribution.hpp
@@ -20,16 +20,16 @@ namespace distribution {
* regression (HMMR) as described in
* https://www.ima.umn.edu/preprints/January1994/1195.pdf
* The hmm observations should have the dependent variable in the first row,
- * with the independent variables in the other rows.
+ * with the independent variables in the other rows.
*/
class RegressionDistribution
{
private:
- //! Regression function for representing conditional mean.
- regression::LinearRegression rf;
+ //! Regression function for representing conditional mean.
+ regression::LinearRegression rf;
//! Error distribution
GaussianDistribution err;
-
+
public:
/**
* Default constructor, which creates a Gaussian with zero dimension.
@@ -38,24 +38,24 @@ class RegressionDistribution
/**
* Create a Conditional Gaussian distribution with conditional mean function
- * obtained by running RegressionFunction on predictors, responses.
- *
+ * obtained by running RegressionFunction on predictors, responses.
+ *
* @param predictors Matrix of predictors (X).
* @param responses Vector of responses (y).
*/
RegressionDistribution(const arma::mat& predictors,
- const arma::vec& responses) :
- rf(regression::LinearRegression(predictors, responses))
+ const arma::vec& responses) :
+ rf(regression::LinearRegression(predictors, responses))
{
- err = GaussianDistribution(1);
- err.Covariance() = rf.ComputeError(predictors, responses);
+ err = GaussianDistribution(1);
+ err.Covariance() = rf.ComputeError(predictors, responses);
}
/**
* Returns a string representation of this object.
*/
std::string ToString() const;
-
+
// Return regression function
const regression::LinearRegression& Rf() {return rf;}
@@ -65,21 +65,21 @@ class RegressionDistribution
* @param observations List of observations.
*/
void Estimate(const arma::mat& observations);
-
+
/**
* Estimate parameters using provided observation weights
*
* @param weights probability that given observation is from distribution
*/
void Estimate(const arma::mat& observations, const arma::vec& weights);
-
+
/**
- * Evaluate probability density function of given observation
+ * Evaluate probability density function of given observation
*
* @param observation point to evaluate probability at
*/
double Probability(const arma::vec& observation) const;
-
+
/**
* Calculate y_i for each data point in points.
*
@@ -87,8 +87,8 @@ class RegressionDistribution
* @param predictions y, will contain calculated values on completion.
*/
void Predict(const arma::mat& points, arma::vec& predictions) const;
-
- //! Return the parameters (the b vector).
+
+ //! Return the parameters (the b vector).
const arma::vec& Parameters() const { return rf.Parameters(); }
//! Return the dimensionality (2) NEED TO FIX THIS
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list