Machine Learning
Implemented — as hand-rolled numeric examples in ordinary
Karkain arithmetic under examples/10-machine-learning/, byte-identical on
both engines.
The honest label matters here: Karkain has no tensor types, no autodiff, no ML framework callable from ``.kark``. The matrix/vector machinery built in Phases 71–78 exists as compiler/backend infrastructure, not as a language surface. These examples instead implement two classic learning algorithms with plain floats, arrays and loops — which is exactly the kind of program a Karkain 1.2.0 user should be able to write today.
File |
Demonstrates |
|---|---|
|
Closed-form ordinary least squares over a synthetic point set |
|
Iterative loss minimization over a convex 1-D surface |
Linear regression (excerpt)
func main() {
let xs = [1.0, 2.0, 3.0, 4.0]
let ys = [2.0, 4.0, 6.0, 8.0]
...
}
Legend: 0.9 / 1.3 / 6.7 pins the learned slope, intercept and a
prediction for the synthetic fit.
Run:
$ karkain run examples/10-machine-learning/01_linear_regression.kark