Language
Go
- First appeared
- 2009
- Paradigm
- Imperative, concurrent
- Toolchain
- Go 1.27.3
- Container image
golang:1.27.3-trixie
Go was designed at Google for large server programs, and it is better known
for web services and command-line tools than for data science. It is
compiled and statically typed, but small enough to read without much
practice. The standard library has CSV parsing, math, and sorting, but no
statistics package, so there is nothing to avoid here: every formula is
written out as a loop. Each program is a single main.go with no go.mod
file, so it can import only the standard library, and the runner compiles it
into /tmp before running it.
Quirks
- Go never converts between number types on its own: dividing a
float64by anintis a compile error, so counts are wrapped infloat64(n). - An unused import or local variable is a compile error, not a warning.
- Map iteration order is randomized and changes from run to run, so code that needs a fixed order sorts the keys first.
Concepts in Go
- Cross-validation
- Decision tree
- Descriptive statistics
- k-means clustering
- k-nearest neighbors
- Linear regression
- Logistic regression
- Naive Bayes
- Principal component analysis
Run the examples locally
You need Docker and Python 3. The harness builds the pinned container and runs every Go example:
git clone https://github.com/qnixon/dswithx.git
cd dswithx
python3 harness/run_tests.py --language go