-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Linear Regression support for Vectors. #3601
Add Linear Regression support for Vectors. #3601
Conversation
22c3acf
to
d10e5cb
Compare
Spreadsheet used to create test data: |
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Regression.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Regression.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Regression.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Regression.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Regression.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Regression.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Regression.enso
Outdated
Show resolved
Hide resolved
std-bits/base/src/main/java/org/enso/base/statistics/FitError.java
Outdated
Show resolved
Hide resolved
std-bits/base/src/main/java/org/enso/base/statistics/LinearModel.java
Outdated
Show resolved
Hide resolved
std-bits/base/src/main/java/org/enso/base/statistics/Regression.java
Outdated
Show resolved
Hide resolved
std-bits/base/src/main/java/org/enso/base/statistics/CorrelationStatistics.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all good, just a few minor, mostly stylistic comments.
e0b2a55
to
57c7932
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit suprised by two Vector
s - one for x
and one for y
|
||
## Use Least Squares to fit a line to the data. | ||
fit_least_squares : Vector -> Vector -> Model -> Fitted_Model ! Illegal_Argument_Error | Fit_Error | ||
fit_least_squares known_xs known_ys model=Linear_Model = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering how one can do a linear regression on a single Vector
!? But there are two!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fit_least_squares (input.map _.first) (input.map _.second)
would be one way to achieve this.
|
||
Test.specify "predict values on a power trend line" <| | ||
known_xs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | ||
known_ys = [0.26128, 0.28144, 0.26353, 0.30247, 0.28677, 0.23992, 0.30586, 0.32785, 0.26324, 0.3411] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather expect zipped array or array and a function - unless this comes from two columns in a table, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expect it to come from 2 columns in a table In due course.
Pull Request Description
Adds least squares regression APIs. Covers the basic 4 trend line types from Excel (doesn't cover Polynomial or Moving Average).
Removes the old
Model
from theStandard.Table
.Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide dist
and./run ide watch
.