src/linear_regression.bend checks
raw source on the hub · import 0x53dde92df75268075f1bc6c33ecbb079/src/linear_regression.bend as Linear_regression
4 imports
import Base import ./batch.bend as Batch import ./numeric.bend as Numeric import ./stats.bend as Stats
Types
type Model source · line 7 · raw
Data
Ordinary least squares with one input feature and a fitted intercept.
Model@slope:F32 -> @intercept:F32 -> Model
type FitError source · line 10 · raw
Data
NotEnoughSamplesFitError
NonFiniteDataFitError
ConstantFeatureFitError
NumericalFailureFitError
Definitions
def error_message source · line 16 · raw
@error:FitError -> String
def checked_model source · line 27 · raw
@ok:Bool -> @slope:F32 -> @intercept:F32 -> Result<&2, &2, FitError, Model>
def solve source · line 34 · raw
@nonzero:Bool -> @mean_x:F32 -> @mean_y:F32 -> @xx:F32 -> @xy:F32 -> Result<&2, &2, FitError, Model>
def checked_moments source · line 43 · raw
@ok:Bool -> @mean_x:F32 -> @mean_y:F32 -> @+xx:F32 -> @xy:F32 -> Result<&2, &2, FitError, Model>
def checked_input source · line 50 · raw
@valid:Bool -> @+mean_x:F32 -> @+mean_y:F32 -> @+xx:F32 -> @+xy:F32 -> Result<&2, &2, FitError, Model>
def finish source · line 58 · raw
@stats:0x53dde92df75268075f1bc6c33ecbb079/src/stats.Moments -> Result<&2, &2, FitError, Model>
def fit source · line 71 · raw
@rows:0x53dde92df75268075f1bc6c33ecbb079/src/batch.Batch<0x53dde92df75268075f1bc6c33ecbb079/src/stats.Sample> -> Result<&2, &2, FitError, Model>
def predict source · line 74 · raw
@model:Model -> @x:F32 -> F32
def predict_batch source · line 79 · raw
@+model:Model -> @rows:0x53dde92df75268075f1bc6c33ecbb079/src/batch.Batch<F32> -> 0x53dde92df75268075f1bc6c33ecbb079/src/batch.Batch<F32>