LinearRegression

public protocol LinearRegression

Linear Regression.

Reference: “Linear regression”

  • Whether to calculate the intercept for this model.

    Declaration

    Swift

    var fitIntercept: Bool { get set }
  • The weights of the model.

    Declaration

    Swift

    var weights: Tensor<Float> { get set }
  • Fit a linear model.

    Declaration

    Swift

    mutating func fit(data: Tensor<Float>, labels: Tensor<Float>)
  • prediction(for:) Default implementation

    Returns prediction using linear model.

    Default Implementation

    Returns prediction using linear model.

    Declaration

    Swift

    mutating func prediction(for data: Tensor<Float>) -> Tensor<Float>
  • score(data:labels:) Default implementation

    Returns the coefficient of determination (R^2) of the prediction.

    Default Implementation

    Returns the coefficient of determination (R^2) of the prediction.

    Declaration

    Swift

    mutating func score(data: Tensor<Float>, labels: Tensor<Float>) -> Float