Documentation of 'smile.regression.RLS' Java class
RLS
smile.regression

Class RLS

  • All Implemented Interfaces:
    java.io.Serializable, OnlineRegression<double[]>, Regression<double[]>


    public class RLS
    extends java.lang.Object
    implements OnlineRegression<double[]>, java.io.Serializable
    Recursive least squares. RLS updates an ordinary least squares with samples that arrive sequentially. To initialize RLS, we typically train an OLS model with a batch of samples. In some adaptive configurations it can be useful not to give equal importance to all the historical data but to assign higher weights to the most recent data (and then to forget the oldest one). This may happen when the phenomenon underlying the data is non stationary or when we want to approximate a nonlinear dependence by using a linear model which is local in time. Both these situations are common in adaptive control problems.

    References

    1. https://www.otexts.org/1582
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  RLS.Trainer
      Trainer for linear regression by recursive least squares.
    • Constructor Summary

      Constructors 
      Constructor and Description
      RLS(double[][] x, double[] y)
      Constructor.
      RLS(double[][] x, double[] y, double lambda)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double[] coefficients()
      Returns the linear coefficients, of which the last element is the intercept.
      double getForgettingFactor()
      Get the forgetting factor
      void learn(double[][] x, double[] y)
      Learn a new instance with online regression.
      void learn(double[] x, double y)
      Learn a new instance with online regression.
      double predict(double[] x)
      Predicts the dependent variable of an instance.
      void setForgettingFactor(double lambda)
      Set the forgetting factor
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RLS

        public RLS(double[][] x,
                   double[] y)
        Constructor. Learn the ordinary least squares model to initialize gamma and coefficients.
        Parameters:
        x - a matrix containing the explanatory variables. NO NEED to include a constant column of 1s for bias.
        y - the response values.
      • RLS

        public RLS(double[][] x,
                   double[] y,
                   double lambda)
        Constructor. Learn the ordinary least squares model to initialize gamma and coefficients.
        Parameters:
        x - a matrix containing the explanatory variables. NO NEED to include a constant column of 1s for bias.
        y - the response values.
        lambda - the forgetting factor.
    • Method Detail

      • coefficients

        public double[] coefficients()
        Returns the linear coefficients, of which the last element is the intercept.
      • predict

        public double predict(double[] x)
        Description copied from interface: Regression
        Predicts the dependent variable of an instance.
        Specified by:
        predict in interface Regression<double[]>
        Parameters:
        x - the instance.
        Returns:
        the predicted value of dependent variable.
      • learn

        public void learn(double[][] x,
                          double[] y)
        Learn a new instance with online regression.
        Parameters:
        x - the training instances.
        y - the target values.
      • learn

        public void learn(double[] x,
                          double y)
        Learn a new instance with online regression.
        Specified by:
        learn in interface OnlineRegression<double[]>
        Parameters:
        x - the training instance.
        y - the target value.
      • getForgettingFactor

        public double getForgettingFactor()
        Get the forgetting factor
        Returns:
        the forgetting factor
      • setForgettingFactor

        public void setForgettingFactor(double lambda)
        Set the forgetting factor
        Parameters:
        lambda - the forgetting factor

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.