Changeset 731 for trunk/yat/regression


Ignore:
Timestamp:
Jan 6, 2007, 5:06:19 PM (15 years ago)
Author:
Peter
Message:

added test for multidimensional weighted and straight version

Location:
trunk/yat/regression
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/regression/MultiDimensional.cc

    r727 r731  
    2626#include "yat/utility/vector.h"
    2727
     28#include <cassert>
     29
    2830namespace theplu {
    2931namespace yat {
     
    5254  void MultiDimensional::fit(const utility::matrix& x, const utility::vector& y)
    5355  {
     56    assert(x.rows()==y.size());
    5457    covariance_=utility::matrix(x.columns(),x.columns());
    5558    fit_parameters_=utility::vector(x.columns());
     
    7679  double MultiDimensional::predict(const utility::vector& x) const
    7780  {
     81    assert(x.size()==fit_parameters_.size());
    7882    return fit_parameters_ * x;
    7983  }
  • trunk/yat/regression/MultiDimensional.h

    r727 r731  
    6868
    6969    /**
    70        @brief Mean Squared Error
     70       @brief Summed Squared Error
    7171     */
    7272    double chisq(void) const;
  • trunk/yat/regression/MultiDimensionalWeighted.cc

    r718 r731  
    6262  double MultiDimensionalWeighted::predict(const utility::vector& x) const
    6363  {
     64    assert(x.size()==fit_parameters_.size());
    6465    return fit_parameters_ * x;
    6566  }
     
    7879
    7980
    80   double MultiDimensionalWeighted::standard_error(const utility::vector& x) const
     81  double
     82  MultiDimensionalWeighted::standard_error2(const utility::vector& x) const
    8183  {
    8284    double s2 = 0;
     
    8688        s2 += 2*covariance_(i,j)*x(i)*x(j);
    8789    }
    88     return sqrt(s2);
     90    return s2;
    8991  }
    9092
  • trunk/yat/regression/MultiDimensionalWeighted.h

    r718 r731  
    7070    /// @return error of model value in @a x
    7171    ///
    72     double standard_error(const utility::vector& x) const;
     72    double standard_error2(const utility::vector& x) const;
    7373
    7474    ///
  • trunk/yat/regression/PolynomialWeighted.cc

    r729 r731  
    8181    for (size_t i=1; i<=power_; ++i)
    8282      vec(i) = vec(i-1)*x;
    83     return md_.standard_error(vec);
     83    return md_.standard_error2(vec);
    8484  }
    8585
Note: See TracChangeset for help on using the changeset viewer.