Changeset 740 for trunk/yat/regression


Ignore:
Timestamp:
Jan 12, 2007, 4:17:22 PM (15 years ago)
Author:
Peter
Message:

added more test in MultiDimWeighted? and moved some stuff to be implemented in MultiDimWeighted? rather than in PolynomialWeighted?.

Location:
trunk/yat/regression
Files:
4 edited

Legend:

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

    r739 r740  
    6666  }
    6767
     68
     69  const utility::vector& MultiDimensionalWeighted::fit_parameters(void) const
     70  {
     71    return fit_parameters_;
     72  }
     73
    6874  double MultiDimensionalWeighted::predict(const utility::vector& x) const
    6975  {
     
    7581                                                     const double w) const
    7682  {
    77     return standard_error2(x) + s2_/w;
     83    return standard_error2(x) + s2(w);
     84  }
     85
     86
     87  double MultiDimensionalWeighted::s2(const double w) const
     88  {
     89    return s2_/w;
    7890  }
    7991
  • trunk/yat/regression/MultiDimensionalWeighted.h

    r739 r740  
    6666    /// in @a x
    6767    ///
    68     double prediction_error2(const utility::vector& x, const double w) const;
     68    double prediction_error2(const utility::vector& x, const double w=1) const;
    6969
    7070    ///
     
    7676    /// @return parameters of fitted model
    7777    ///
    78     utility::vector fit_parameters(void) { return fit_parameters_; }
     78    const utility::vector& fit_parameters(void) const;
     79
     80    ///
     81    /// @return variance of residuals
     82    ///
     83    double s2(const double w=1.0) const;
    7984
    8085  private:
  • trunk/yat/regression/PolynomialWeighted.cc

    r739 r740  
    3333
    3434  PolynomialWeighted::PolynomialWeighted(size_t power)
    35     : OneDimensionalWeighted(), mse_(0), power_(power)
     35    : OneDimensionalWeighted(), power_(power)
    3636  {
    3737  }
     
    5454  }
    5555
    56   double PolynomialWeighted::s2(const double) const
     56
     57  const utility::vector& PolynomialWeighted::fit_parameters(void) const
    5758  {
    58     return mse_;
     59    return md_.fit_parameters();
     60  }
     61
     62
     63  double PolynomialWeighted::s2(const double w=1.0) const
     64  {
     65    return md_.s2(w);
    5966  }
    6067
  • trunk/yat/regression/PolynomialWeighted.h

    r739 r740  
    6363
    6464    ///
     65    /// @return parameters of the model
     66    ///
     67    /// @see MultiDimensional
     68    ///
     69    const utility::vector& fit_parameters(void) const;
     70
     71    ///
    6572    /// @return parameters for polynomial model
    6673    ///
     
    9097  private:
    9198    MultiDimensionalWeighted md_;
    92     double mse_;
    9399    size_t power_;
    94100
Note: See TracChangeset for help on using the changeset viewer.