org.apache.ignite.ml.regressions.linear

## Class LinearRegressionModel

- java.lang.Object
- - org.apache.ignite.ml.regressions.linear.LinearRegressionModel

- All Implemented Interfaces:
    Serializable, AutoCloseable, Exportable<LinearRegressionModel>, IgniteModel<Vector,Double>, JSONWritable, Model<Vector,Double>

      public final class LinearRegressionModel
      extends Object
      implements IgniteModel<Vector,Double>, Exportable<LinearRegressionModel>, JSONWritable

  Simple linear regression model which predicts result value Y as a linear combination of input variables: Y = weights * X + intercept.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `LinearRegressionModel.LinearRegressionModelJSONExportModel`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LinearRegressionModel(Vector weights, double intercept)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `static LinearRegressionModel` | `fromJSON(Path path)` Loads LinearRegressionModel from JSON file.
    `int` | `hashCode()`
    `double` | `intercept()`
    `Double` | `predict(Vector input)` Make a prediction for the specified input arguments.
    `<P> void` | `saveModel(Exporter<LinearRegressionModel,P> exporter, P path)` Save model by the given path.
    `void` | `toJSON(Path path)`
    `String` | `toString()`
    `String` | `toString(boolean pretty)`
    `Vector` | `weights()`
    `LinearRegressionModel` | `withIntercept(double intercept)` Set up the intercept.
    `LinearRegressionModel` | `withWeights(Vector weights)` Set up the weights.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.ml.IgniteModel

      `andBefore, andThen, andThen, close, combine`

- - ### Constructor Detail

    - #### LinearRegressionModel

          public LinearRegressionModel(Vector weights,
                                       double intercept)

  - ### Method Detail

    - #### weights

          public Vector weights()

    - #### intercept

          public double intercept()

    - #### withWeights

          public LinearRegressionModel withWeights(Vector weights)

      Set up the weights.
      Parameters:
        `weights` - The parameter value.
      Returns:
        Model with new weights parameter value.

    - #### withIntercept

          public LinearRegressionModel withIntercept(double intercept)

      Set up the intercept.
      Parameters:
        `intercept` - The parameter value.
      Returns:
        Model with new intercept parameter value.

    - #### predict

          public Double predict(Vector input)

      Make a prediction for the specified input arguments.
      Specified by:
        `predict` in interface `Model<Vector,Double>`
      Parameters:
        `input` - Input arguments.
      Returns:
        Prediction result.

    - #### saveModel

          public <P> void saveModel(Exporter<LinearRegressionModel,P> exporter,
                                    P path)

      Save model by the given path.
      Specified by:
        `saveModel` in interface `Exportable<LinearRegressionModel>`
      Parameters:
        `exporter` - Exporter.
        `path` - Path to saved model.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toString

          public String toString(boolean pretty)

      Specified by:
        `toString` in interface `IgniteModel<Vector,Double>`
      Parameters:
        `pretty` - Use pretty mode.

    - #### fromJSON

          public static LinearRegressionModel fromJSON(Path path)

      Loads LinearRegressionModel from JSON file.

    - #### toJSON

          public void toJSON(Path path)

      Specified by:
        `toJSON` in interface `JSONWritable`

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021