Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.core.matrix
Class LinearRegression

    java.lang.Object
      weka.core.matrix.LinearRegression

    public class LinearRegression

extends java.lang.Object

Class for performing (ridged) linear regression.

Version:
  $Revision: 1.2.2.2 $
Author:
  Fracpete (fracpete at waikato dot ac dot nz)

Constructor Summary
`LinearRegression(Matrix a, Matrix y, double ridge)` Performs a (ridged) linear regression.
`LinearRegression(Matrix a, Matrix y, double[] w, double ridge)` Performs a weighted (ridged) linear regression.

Method Summary
`double[]` | `getCoefficients()` returns the calculated coefficients
`java.lang.String` | `toString()` returns the coefficients in a string representation

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LinearRegression

    public LinearRegression(Matrix a,
                            Matrix y,
                            double ridge)

  Performs a (ridged) linear regression.

  Parameters:
    `a` - the matrix to perform the regression on
    `y` - the dependent variable vector
    `ridge` - the ridge parameter
  Throws:
    `java.lang.IllegalArgumentException` - if not successful

### LinearRegression

    public LinearRegression(Matrix a,
                            Matrix y,
                            double[] w,
                            double ridge)

  Performs a weighted (ridged) linear regression.

  Parameters:
    `a` - the matrix to perform the regression on
    `y` - the dependent variable vector
    `w` - the array of data point weights
    `ridge` - the ridge parameter
  Throws:
    `java.lang.IllegalArgumentException` - if the wrong number of weights were provided.

Method Detail

### getCoefficients

    public final double[] getCoefficients()

  returns the calculated coefficients

  Returns:
    the coefficients

### toString

    public java.lang.String toString()

  returns the coefficients in a string representation

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD