Scikit-learn's Fit/Predict pattern, ported to Go
GoLearn exists to spare Go developers from reinventing ML primitives by porting scikit-learn’s familiar Fit/Predict interface to the gopher ecosystem.

What it does
GoLearn provides machine learning primitives for Go, wrapping tabular data into Instances objects that support matrix-like operations. You pass those instances to estimators, then evaluate results with built-in helpers for cross-validation, train-test splitting, and confusion matrices. The README walks through a KNN classifier on the Iris dataset, suggesting the library targets standard supervised learning workflows.
The interesting bit
The project’s main bet is familiarity: it mirrors Python’s scikit-learn Fit/Predict API so you can swap estimators with minimal friction. It also claims “simplicity, paired with customisability” as its goal, though the README is light on exactly which knobs are exposed.
Key highlights
- Mirrors a scikit-learn-style
Fit/Predictestimator interface - Loads CSV data into
Instancesstructures with header preservation - Includes evaluation helpers like confusion matrices and train-test splitting
- Ships with practical examples for KNN, trees, and instance manipulation
- Documentation available in English, Simplified Chinese, and Traditional Chinese
Caveats
- The README only surfaces KNN and tree examples, so the full algorithm roster is unclear
- “Customisability” is promised as a goal, but the sources do not detail how deep the tuning goes
Verdict
Worth a look if you want scikit-learn-style ergonomics in Go. Give it a pass if you need a broad algorithm catalog; the README only demonstrates KNN and trees.
Frequently asked
- What is sjwhitworth/golearn?
- GoLearn exists to spare Go developers from reinventing ML primitives by porting scikit-learn’s familiar Fit/Predict interface to the gopher ecosystem.
- Is golearn open source?
- Yes — sjwhitworth/golearn is open source, released under the MIT license.
- What language is golearn written in?
- sjwhitworth/golearn is primarily written in Go.
- How popular is golearn?
- sjwhitworth/golearn has 9.4k stars on GitHub.
- Where can I find golearn?
- sjwhitworth/golearn is on GitHub at https://github.com/sjwhitworth/golearn.