[mlpack-git] master: Rename hmm_regression.hpp (e9cb643)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:01:59 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit e9cb643eec1436b20b72aa0a72cfdec709266e15
Author: michaelfox99 <michaelfox99 at gmail.com>
Date:   Sun Nov 2 17:52:53 2014 +0000

    Rename hmm_regression.hpp


>---------------------------------------------------------------

e9cb643eec1436b20b72aa0a72cfdec709266e15
 ..._regression.hpp => regression_distribution.hpp} | 33 +++++++++++++++-------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/mlpack/core/dists/hmm_regression.hpp b/src/mlpack/core/dists/regression_distribution.hpp
similarity index 72%
copy from src/mlpack/core/dists/hmm_regression.hpp
copy to src/mlpack/core/dists/regression_distribution.hpp
index 3b17cac..b236aa0 100644
--- a/src/mlpack/core/dists/hmm_regression.hpp
+++ b/src/mlpack/core/dists/regression_distribution.hpp
@@ -1,13 +1,14 @@
 /**
- * @file hmm_regression.hpp
+ * @file regression_distribution.hpp
  * @author Michael Fox
  *
  * Implementation of conditional Gaussian distribution for HMM regression (HMMR)
  */
-#ifndef __MLPACK_METHODS_HMM_DISTRIBUTIONS_CONDITIONAL_GAUSSIAN_DISTRIBUTION_HPP
-#define __MLPACK_METHODS_HMM_DISTRIBUTIONS_CONDITIONAL_GAUSSIAN_DISTRIBUTION_HPP
+#ifndef __MLPACK_METHODS_HMM_DISTRIBUTIONS_REGRESSION_DISTRIBUTION_HPP
+#define __MLPACK_METHODS_HMM_DISTRIBUTIONS_REGRESSION_DISTRIBUTION_HPP
 
 #include <mlpack/core.hpp>
+#include <mlpack/core/dists/gaussian_distribution.hpp>
 #include <mlpack/methods/linear_regression/linear_regression.hpp>
 
 namespace mlpack {
@@ -21,7 +22,7 @@ namespace distribution {
  * The hmm observations should have the dependent variable in the first row,
  * with the independent variables in the other rows. 
  */
-class HMMRegression
+class RegressionDistribution
 {
  private:
   //! Regression function for representing conditional mean.   
@@ -33,7 +34,7 @@ class HMMRegression
   /**
    * Default constructor, which creates a Gaussian with zero dimension.
    */
-  HMMRegression() { /* nothing to do */ }
+  RegressionDistribution() { /* nothing to do */ }
 
   /**
    * Create a Conditional Gaussian distribution with conditional mean function
@@ -42,7 +43,7 @@ class HMMRegression
    * @param predictors Matrix of predictors (X).
    * @param responses Vector of responses (y).
    */
-  HMMRegression(const arma::mat& predictors,
+  RegressionDistribution(const arma::mat& predictors,
                                   const arma::vec& responses) :
       rf(regression::LinearRegression(predictors, responses))    
   {
@@ -59,6 +60,13 @@ class HMMRegression
   const regression::LinearRegression& Rf() {return rf;}
 
   /**
+   * Estimate the Gaussian distribution directly from the given observations.
+   *
+   * @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
@@ -72,10 +80,18 @@ class HMMRegression
   */
   double Probability(const arma::vec& observation) const;
   
+  /**
+   * Calculate y_i for each data point in points.
+   *
+   * @param points the data points to calculate with.
+   * @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).
   const arma::vec& Parameters() const { return rf.Parameters(); }
 
-  //! Return the dimensionality (2)
+  //! Return the dimensionality (2) NEED TO FIX THIS
   static const size_t Dimensionality() { return 2; }
 };
 
@@ -83,7 +99,4 @@ class HMMRegression
 }; // namespace distribution
 }; // namespace mlpack
 
-//Include implmentation
-#include "hmm_regression_impl.hpp"
-
 #endif



More information about the mlpack-git mailing list