Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,20 @@
func regress(x, y, degree) {
var A = Matrix.build(x.len, degree+1, {|i,j|
x[i]**j
})
var B = Matrix.column_vector(y...)
((A.transpose * A)**(-1) * A.transpose * B).transpose[0]
}
func poly(x) {
3*x**2 + 2*x + 1
}
var coeff = regress(
10.of { _ },
10.of { poly(_) },
2
)
say coeff