O'Reilly logo
  • black zwei thinks this is interesting:

let regression' = MultipleLinearRegression(3,true) let error' = regression'.Regress(xs',y) let a' = regression'.Coefficients.[0] let b' = regression'.Coefficients.[1] let c' = regression'.Coefficients.[2] let d' = regression'.Coefficients.[3] let mse' = error'/float xs'.Length let rmse' = sqrt(mse') let r2' = regression'.CoefficientOfDetermination(xs',y)

From

Cover of Mastering .NET Machine Learning

Note

try use blow instead in 3.4.0:

let regression = OrdinaryLeastSquares().Learn(xs, y)
let intercept = regression.Intercept
let a = regression.Weights.[0]
let b = regression.Weights.[1]
let c = regression.Intercept;

// sum of square error
let loss = new SquareLoss(y)
// mean if mean then mse(default)
loss.Mean <- false
let actual = regression.Transform(xs)
let sse = loss.Loss(actual)

let r2 = regression.CoefficientOfDetermination(xs,y)