LinearRegression
Simple linear regression using least squares. Fits y = X * coefficients via the normal equation.
Operations
Fit
Fits the model to training data using least squares.
method : public : Fit(X:Float[,], y:Float[,]) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| X | Float | feature matrix (rows=samples, cols=features) |
| y | Float | target matrix (rows=samples, cols=1) |
Return
| Type | Description |
|---|---|
| Bool | true if fitting succeeded |
GetCoefficients
Gets the computed coefficients.
method : public : GetCoefficients() ~ Float[]Return
| Type | Description |
|---|---|
| Float | coefficient array, or Nil if not fitted |
GetRSquared
Gets the R-squared goodness of fit.
method : public : GetRSquared() ~ FloatReturn
| Type | Description |
|---|---|
| Float | R-squared value |
IsFitted
Whether the model has been fitted.
method : public : IsFitted() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if fitted |