Aigo - AI in Go

aigo is a Go library for building and training artificial intelligence models. It aims to provide a simple yet powerful API for creating neural networks, implementing training algorithms, and making predictions — all in pure Go.

Key Features

Functional Programming Approach

Built with functional programming principles in mind, Aigo emphasizes immutability, pure functions, and composable operations for building ML pipelines.

Robust Error Handling

Leveraging Go's explicit error handling, every operation returns clear errors, making debugging and maintenance straightforward.

Native Performance

Written in pure Go, Aigo compiles to native machine code, providing excellent performance without CGO overhead or external dependencies.

Live MLP Demo

Test the Multi-Layer Perceptron model trained with Aigo. Draw a circle or a cross below and the AI will guess what you've drawn!

—
Draw to test the model!
⭕ 0% ❌ 0%
MLP 256→128→64→2 | 6000 images

Quick Example

package main

import (
    "fmt"
    "github.com/eleby/aigo/MLP"
)

func main() {
    var init MLP.Init
    init.NumFeatures = 256
    init.LayerSizes = []int{128, 64, 2}
    init.LearningRate = 0.01

    mlp, _ := MLP.CreateNetwork(init)
    mlp.Train(inputs, targets, 1000)
    predictions := mlp.Predict(tests)
}

Architecture

Aigo is designed with a modular architecture that allows you to plug in custom layers, optimizers, and loss functions while providing sensible defaults for common use cases.

  • Neural Networks — Fully connected neural networks with configurable layers
  • Gradient Descent — Stochastic gradient descent and variants for training
  • Activation Functions — Sigmoid, ReLU, Tanh, and other activation functions
  • Loss Functions — MSE, Cross-Entropy, and custom loss functions