Skip to content

AILinearRegressionLeastSquaresVanilla doesn't give the correct result for <4 variables #24

@DurieuxPol

Description

@DurieuxPol
inputMatrix := #( #(1 2) #(2 3) ).
outputVector := #( 3 5 ).

model := AILinearRegressionLeastSquaresVanilla new.
model fitX: (PMMatrix rows: inputMatrix ) y: outputVector.
model predict: #( #(3 1) #( 2 5) )

Here the result should be (4 7), the output is simply x1 + x2, but it gives (-8.074767078498812 9.366563145999471), while the Lapack version gives the correct answer:

inputMatrix := #( #(1 2) #(2 3) ).
outputVector := #( 3 5 ).

model := AILinearRegressionLeastSquares new.
model fitX: (AIColumnMajorMatrix rows: inputMatrix ) y: outputVector.
model predict: #( #(3 1) #( 2 5) )

I tested several formats for the input (2 variables and 2 rows, 3 variables and 2 rows, 3 variables and 3 rows, 4 variables and 3 rows), and it seems that the issue disappears with 4 variables or more.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions