#ifndef _theplu_yat_regression_local_
#define _theplu_yat_regression_local_
// $Id: Local.h 1000 2007-12-23 20:09:15Z jari $
/*
Copyright (C) 2004 Peter Johansson
Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson
Copyright (C) 2007 Peter Johansson
This file is part of the yat library, http://trac.thep.lu.se/yat
The yat library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The yat library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#include "yat/utility/vector.h"
#include
namespace theplu {
namespace yat {
namespace regression {
class Kernel;
class OneDimensionalWeighted;
///
/// @brief Class for Locally weighted regression.
///
/// Locally weighted regression is an algorithm for learning
/// continuous non-linear mappings in a non-parametric manner. In
/// locally weighted regression, points are weighted by proximity to
/// the current x in question using a Kernel. A weighted regression
/// is then computed using the weighted points and a specific
/// Regression method. This procedure is repeated, which results in
/// a pointwise approximation of the underlying (unknown) function.
///
class Local
{
public:
///
/// @brief Constructor taking type of \a regressor,
/// type of \a kernel.
///
Local(OneDimensionalWeighted& r, Kernel& k);
///
/// @brief The destructor
///
virtual ~Local(void);
///
/// adding a data point
///
void add(const double x, const double y);
///
/// @param nof_points Number of points used in each fit
/// @param step_size Size of step between each fit
///
void fit(const size_t step_size, const size_t nof_points);
///
/// @return x-values where fitting was performed.
///
const utility::vector& x(void) const;
///
/// Function returning predicted values
///
const utility::vector& y_predicted(void) const;
///
/// Function returning error of predictions
///
const utility::vector& y_err(void) const;
private:
///
/// Copy Constructor. (Not implemented)
///
Local(const Local&);
std::vector > data_;
Kernel* kernel_;
OneDimensionalWeighted* regressor_;
utility::vector x_;
utility::vector y_predicted_;
utility::vector y_err_;
};
///
/// The output operator for the Regression::Local class.
///
std::ostream& operator<<(std::ostream&, const Local& );
}}} // of namespaces regression, yat, and theplu
#endif