SciGo ๐
SciGo's official mascot - Ready, Set, SciGo!
The blazing-fast scikit-learn compatible ML library for Go
Say "Goodbye" to slow ML, "Sci-Go" to fast learning!

๐ Why SciGo?
SciGo = Statistical Computing In Go
SciGo brings the power and familiarity of scikit-learn to the Go ecosystem, offering:
- ๐ฅ Blazing Fast: Native Go implementation with built-in parallelization
- ๐ฏ scikit-learn Compatible: Familiar Fit/Predict API for easy migration
- ๐ Well Documented: Complete API documentation with examples on pkg.go.dev
- ๐ Streaming Support: Online learning algorithms for real-time data
- ๐ Zero Heavy Dependencies: Pure Go implementation (only scientific essentials)
- ๐ Comprehensive: Regression, classification, clustering, and more
- ๐งช Production Ready: Extensive tests, benchmarks, and error handling
๐ฆ Installation
go get github.com/YuminosukeSato/scigo
๐ Quick Start
๐ก Tip: For complete API documentation with examples, visit pkg.go.dev/scigo
package main
import (
"fmt"
"log"
"github.com/YuminosukeSato/scigo/linear"
"gonum.org/v1/gonum/mat"
)
func main() {
// Create and train model - just like scikit-learn!
model := linear.NewLinearRegression()
// Training data
X := mat.NewDense(4, 2, []float64{
1, 1,
1, 2,
2, 2,
2, 3,
})
y := mat.NewDense(4, 1, []float64{
2, 3, 3, 4,
})
// Fit the model
if err := model.Fit(X, y); err != nil {
log.Fatal(err)
}
// Make predictions
XTest := mat.NewDense(2, 2, []float64{
1.5, 1.5,
2.5, 3.5,
})
predictions, _ := model.Predict(XTest)
fmt.Println("Ready, Set, SciGo! Predictions:", predictions)
}
๐ API Documentation

๐ Package Documentation
| Package |
Description |
Go Doc |
| preprocessing |
Data preprocessing utilities (StandardScaler, MinMaxScaler, OneHotEncoder) |
 |
| linear |
Linear machine learning algorithms (LinearRegression) |
 |
| metrics |
Model evaluation metrics (MSE, RMSE, MAE, Rยฒ, MAPE) |
 |
| core/model |
Base model abstractions and interfaces |
 |
๐ Complete API Examples
The documentation includes comprehensive examples for all major APIs. Visit the Go Doc links above or use go doc locally:
# View package documentation
go doc github.com/YuminosukeSato/scigo/preprocessing
go doc github.com/YuminosukeSato/scigo/linear
go doc github.com/YuminosukeSato/scigo/metrics
# View specific function documentation
go doc github.com/YuminosukeSato/scigo/preprocessing.StandardScaler.Fit
go doc github.com/YuminosukeSato/scigo/linear.LinearRegression.Predict
go doc github.com/YuminosukeSato/scigo/metrics.MSE
# Run example tests
go test -v ./preprocessing -run Example
go test -v ./linear -run Example
go test -v ./metrics -run Example
๐ Algorithms
Supervised Learning
Linear Models
- โ
Linear Regression - Classic OLS regression with parallel processing
- โ
SGD Regressor - Stochastic Gradient Descent for large-scale learning
- โ
SGD Classifier - Linear classifiers with SGD training
- โ
Passive-Aggressive - Online learning for classification and regression
Data Preprocessing
- โ
StandardScaler - Standardizes features by removing mean and scaling to unit variance
- โ
MinMaxScaler - Scales features to a given range (e.g., [0,1] or [-1,1])
- โ
OneHotEncoder - Encodes categorical features as one-hot numeric arrays
Tree-based Models
- ๐ง Random Forest (Coming Soon)
- ๐ง Gradient Boosting (Coming Soon)
- ๐ง XGBoost compatibility (Coming Soon)
Unsupervised Learning
Clustering
- โ
MiniBatch K-Means - Scalable K-Means for large datasets
- ๐ง DBSCAN (Coming Soon)
- ๐ง Hierarchical Clustering (Coming Soon)
Special Features
Online Learning & Streaming
- โ
Incremental Learning - Update models with new data batches
- โ
Partial Fit - scikit-learn compatible online learning
- โ
Concept Drift Detection - DDM and ADWIN algorithms
- โ
Streaming Pipelines - Real-time data processing with channels
๐ฏ scikit-learn Compatibility
SciGo implements the familiar scikit-learn API:
// Just like scikit-learn!
model.Fit(X, y) // Train the model
model.Predict(X) // Make predictions
model.Score(X, y) // Evaluate the model
model.PartialFit(X, y) // Incremental learning
// Streaming - unique to Go!
model.FitStream(ctx, dataChan) // Streaming training
SciGo leverages Go's concurrency for exceptional performance:
| Algorithm |
Dataset Size |
SciGo |
scikit-learn (Python) |
Speedup |
| Linear Regression |
1Mร100 |
245ms |
890ms |
3.6ร |
| SGD Classifier |
500Kร50 |
180ms |
520ms |
2.9ร |
| MiniBatch K-Means |
100Kร20 |
95ms |
310ms |
3.3ร |
| Streaming SGD |
1M streaming |
320ms |
1.2s |
3.8ร |
Benchmarks on MacBook Pro M2, 16GB RAM
Memory Efficiency
| Dataset Size |
Memory |
Allocations |
| 100ร10 |
22.8KB |
22 |
| 1,000ร10 |
191.8KB |
22 |
| 10,000ร20 |
3.4MB |
57 |
| 50,000ร50 |
41.2MB |
61 |
๐๏ธ Architecture
scigo/
โโโ linear/ # Linear models
โโโ sklearn/ # scikit-learn compatible implementations
โ โโโ linear_model/ # SGD, Passive-Aggressive
โ โโโ cluster/ # Clustering algorithms
โ โโโ drift/ # Concept drift detection
โโโ metrics/ # Evaluation metrics
โโโ core/ # Core abstractions
โ โโโ model/ # Base model interfaces
โ โโโ tensor/ # Tensor operations
โ โโโ parallel/ # Parallel processing
โโโ datasets/ # Dataset utilities
โโโ examples/ # Usage examples
๐ Metrics
Comprehensive evaluation metrics with full documentation:
- Regression Metrics:
- Classification: Accuracy, Precision, Recall, F1-Score, ROC-AUC (coming)
- Clustering: Silhouette Score, Davies-Bouldin Index (coming)
๐งช Testing & Quality
# Run tests
go test ./...
# Run benchmarks
go test -bench=. -benchmem ./...
# Check coverage (76.7% overall coverage)
go test -cover ./...
# Run linter (errcheck, govet, ineffassign, staticcheck, unused, misspell)
make lint-full
# Run examples to see API usage
go test -v ./preprocessing -run Example
go test -v ./linear -run Example
go test -v ./metrics -run Example
go test -v ./core/model -run Example
Quality Gates
- โ
Test Coverage: 76.7% (target: 70%+)
- โ
Linting: golangci-lint with comprehensive checks
- โ
Documentation: Complete godoc for all public APIs
- โ
Examples: Comprehensive example functions for all major APIs
๐ Examples
Check out the examples directory:
๐ค Contributing
We welcome contributions! Please see our Contributing Guide.
Development Setup
# Clone the repository
git clone https://github.com/YuminosukeSato/scigo.git
cd scigo
# Install dependencies
go mod download
# Run tests
go test ./...
# Run linter
golangci-lint run
๐บ๏ธ Roadmap
Phase 1: Core ML (Current)
- โ
Linear models
- โ
Online learning
- โ
Basic clustering
- ๐ง Tree-based models
Phase 2: Advanced Features
- Neural Networks (MLP)
- Deep Learning integration
- Model serialization (ONNX export)
- GPU acceleration
Phase 3: Enterprise Features
- Distributed training
- AutoML capabilities
- Model versioning
- A/B testing framework
๐ Documentation
Core Documentation
API Quick Reference
Guides (Coming Soon)
๐ Acknowledgments
๐ License
SciGo is licensed under the MIT License. See LICENSE for details.
๐ Ready, Set, SciGo! ๐
Where Science Meets Go - Say goodbye to slow ML!
Made with โค๏ธ and lots of โ in Go