LeastSquaresLinearRegression

public class LeastSquaresLinearRegression : LinearRegression

Least Squares linear regression.

Reference: “Least Squares linear regression”

  • Whether to calculate the intercept for this model.

    Declaration

    Swift

    public var fitIntercept: Bool
  • The weights of the model.

    Declaration

    Swift

    public var weights: Tensor<Float>
  • Creates a linear regression model.

    Declaration

    Swift

    public init(
        fitIntercept: Bool = true
    )

    Parameters

    fitIntercept

    Whether to calculate the intercept for this model. If false, no intercept will be used in calculations. The default is true.

  • Fit a linear model.

    Declaration

    Swift

    public func fit(data: Tensor<Float>, labels: Tensor<Float>)

    Parameters

    data

    Training data with shape [sample count, feature count].

    labels

    Target value with shape [sample count, target count].