A High-level Machine Learning Library for Go

logo
GoDoc Go Report Card

Overview

Goro is a high-level machine learning library for Go built on Gorgonia. It aims to have the same feel as Keras.

Usage

import (
    . "github.com/aunum/goro/pkg/v1/model"
    "github.com/aunum/goro/pkg/v1/layer"
)

// create the 'x' input e.g. mnist image
x := NewInput("x", []int{1, 28, 28})

// create the 'y' or expect output e.g. labels
y := NewInput("y", []int{10})

// create a new sequential model with the name 'mnist'
model, _ := NewSequential("mnist")

// add layers to the model
model.AddLayers(
    layer.Conv2D{Input: 1, Output: 32, Width: 3, Height: 3},
    layer.MaxPooling2D{},
    layer.Conv2D{Input: 32, Output: 64, Width: 3, Height: 3},
    layer.MaxPooling2D{},
    layer.Conv2D{Input: 64, Output: 128, Width: 3, Height: 3},
    layer.MaxPooling2D{},
    layer.Flatten{},
    layer.FC{Input: 128 * 3 * 3, Output: 100},
    layer.FC{Input: 100, Output: 10, Activation: layer.Softmax},
)

// pick an optimizer
optimizer := g.NewRMSPropSolver()

// compile the model with options
model.Compile(xi, yi,
    WithOptimizer(optimizer),
    WithLoss(m.CrossEntropy),
    WithBatchSize(100),
)

// fit the model
model.Fit(xTrain, yTrain)

// use the model to predict an 'x'
prediction, _ := model.Predict(xTest)

// fit the model with a batch
model.FitBatch(xTrainBatch, yTrainBatch)

// use the model to predict a batch of 'x'
prediction, _ = model.PredictBatch(xTestBatch)

Examples

See the examples folder for example implementations.

There are many examples in the reinforcement learning library Gold.

Docs

Each package contains a README explaining the usage, also see GoDoc.

Contributing

Please open an MR for any issues or feature requests.

Feel free to ping @pbarker on Gopher slack.

Roadmap

  • RNN
  • LSTM
  • Summary
  • Visualization
Similar Resources

PaddleDTX is a solution that focused on distributed machine learning technology based on decentralized storage.

PaddleDTX is a solution that focused on distributed machine learning technology based on decentralized storage.

中文 | English PaddleDTX PaddleDTX is a solution that focused on distributed machine learning technology based on decentralized storage. It solves the d

Dec 14, 2022

Go (Golang) encrypted deep learning library; Fully homomorphic encryption over neural network graphs

DC DarkLantern A lantern is a portable case that protects light, A dark lantern is one who's light can be hidden at will. DC DarkLantern is a golang i

Oct 31, 2022

Training materials and labs for a "Getting Started" level course on COBOL

COBOL Programming Course This project is a set of training materials and labs for COBOL on z/OS. The following books are available within this reposit

Dec 30, 2022

Reinforcement Learning in Go

Reinforcement Learning in Go

Overview Gold is a reinforcement learning library for Go. It provides a set of agents that can be used to solve challenges in various environments. Th

Dec 11, 2022

Spice.ai is an open source, portable runtime for training and using deep learning on time series data.

Spice.ai is an open source, portable runtime for training and using deep learning on time series data.

Spice.ai Spice.ai is an open source, portable runtime for training and using deep learning on time series data. ⚠️ DEVELOPER PREVIEW ONLY Spice.ai is

Dec 15, 2022

FlyML perfomant real time mashine learning libraryes in Go

FlyML perfomant real time mashine learning libraryes in Go simple & perfomant logistic regression (~100 LoC) Status: WIP! Validated on mushrooms datas

May 30, 2022

A tool for building identical machine images for multiple platforms from a single source configuration

A tool for building identical machine images for multiple platforms from a single source configuration

Packer Packer is a tool for building identical machine images for multiple platforms from a single source configuration. Packer is lightweight, runs o

Oct 3, 2021

A high performance go implementation of Wappalyzer Technology Detection Library

wappalyzergo A high performance port of the Wappalyzer Technology Detection Library to Go. Inspired by https://github.com/rverton/webanalyze. Features

Jan 8, 2023

A high-performance timeline tracing library for Golang, used by TiDB

Minitrace-Go A high-performance, ergonomic timeline tracing library for Golang. Basic Usage package main import ( "context" "fmt" "strcon

Nov 28, 2022
Comments
  • Type Error

    Type Error

    Hi, I am new to using goro and cnns in general so right now I am trying to run the example mnist go file. However, I am running into the following error with WithOptimizer:

    cannot use optimizer (variable of type *gorgonia.RMSPropSolver) as gorgonia.Solver value in argument to m.WithOptimizer: wrong type for method Step (have func(model []gorgonia.org/gorgonia.ValueGrad) (err error), want func([]gorgonia.org/gorgonia.ValueGrad) error)compilerInvalidIfaceAssign

    I haven't changed anything in the example main.go file and I can import the following with no errors:

    import (
    	"github.com/aunum/gold/pkg/v1/common/num"
    	"github.com/aunum/gold/pkg/v1/common/require"
    	"github.com/aunum/gold/pkg/v1/dense"
    	"github.com/aunum/goro/pkg/v1/layer"
    	m "github.com/aunum/goro/pkg/v1/model"
    	"github.com/aunum/log"
    
    	g "gorgonia.org/gorgonia"
    	"gorgonia.org/gorgonia/examples/mnist"
    	"gorgonia.org/tensor"
    )
    

    I am just confused as to why WithOptimizer is not working for me. Thanks!

  • Using `Init: gorgonia.Zeroes()` in every layer does not make output always zero

    Using `Init: gorgonia.Zeroes()` in every layer does not make output always zero

    Initializing network with the following code:

    qModel, err := m.NewSequential("qLearning")
    if err != nil {
    	return nil, err
    }
    
    xShape := []int{1, 71}
    yShape := []int{1, 16}
    in := m.NewInput("state", xShape)
    out := m.NewInput("actionValue", yShape)
    
    qModel.AddLayers(
    	layer.FC{Input: in.Squeeze()[0], Output: 256, Init: gorgonia.Zeroes()},
    	layer.FC{Input: 256, Output: 128, Init: gorgonia.Zeroes()},
    	layer.FC{Input: 128, Output: 64, Init: gorgonia.Zeroes()},
    	layer.FC{Input: 64, Output: 32, Init: gorgonia.Zeroes()},
    	layer.FC{Input: 32, Output: out.Squeeze()[0], Activation: layer.Linear, Init: gorgonia.Zeroes()},
    )
    
    err = qModel.Compile(in, out,
    	m.WithBatchSize(1),
    )
    if err != nil {
    	return nil, err
    }
    

    I want the initial output of the network to be zero for any input. What am I doing wrong?

  • Create SetLearnables

    Create SetLearnables

    SetLearnables is a slight tweak on CloneLearnablesTo. It receives desired learnables of type gorgonia.Nodes and sets them in the present sequantial model.

Gorgonia is a library that helps facilitate machine learning in Go.
Gorgonia is a library that helps facilitate machine learning in Go.

Gorgonia is a library that helps facilitate machine learning in Go. Write and evaluate mathematical equations involving multidimensional arrays easily

Dec 27, 2022
Self-contained Machine Learning and Natural Language Processing library in Go
Self-contained Machine Learning and Natural Language Processing library in Go

Self-contained Machine Learning and Natural Language Processing library in Go

Jan 8, 2023
Machine Learning for Go
Machine Learning for Go

GoLearn GoLearn is a 'batteries included' machine learning library for Go. Simplicity, paired with customisability, is the goal. We are in active deve

Jan 3, 2023
On-line Machine Learning in Go (and so much more)

goml Golang Machine Learning, On The Wire goml is a machine learning library written entirely in Golang which lets the average developer include machi

Jan 5, 2023
Machine Learning libraries for Go Lang - Linear regression, Logistic regression, etc.

package ml - Machine Learning Libraries ###import "github.com/alonsovidales/go_ml" Package ml provides some implementations of usefull machine learnin

Nov 10, 2022
Prophecis is a one-stop machine learning platform developed by WeBank
Prophecis is a one-stop machine learning platform developed by WeBank

Prophecis is a one-stop machine learning platform developed by WeBank. It integrates multiple open-source machine learning frameworks, has the multi tenant management capability of machine learning compute cluster, and provides full stack container deployment and management services for production environment.

Dec 28, 2022
Go Machine Learning Benchmarks
Go Machine Learning Benchmarks

Benchmarks of machine learning inference for Go

Dec 30, 2022
Deploy, manage, and scale machine learning models in production
Deploy, manage, and scale machine learning models in production

Deploy, manage, and scale machine learning models in production. Cortex is a cloud native model serving platform for machine learning engineering teams.

Dec 30, 2022
Standard machine learning models

Cog: Standard machine learning models Define your models in a standard format, store them in a central place, run them anywhere. Standard interface fo

Jan 9, 2023
Katib is a Kubernetes-native project for automated machine learning (AutoML).
Katib is a Kubernetes-native project for automated machine learning (AutoML).

Katib is a Kubernetes-native project for automated machine learning (AutoML). Katib supports Hyperparameter Tuning, Early Stopping and Neural Architec

Jan 2, 2023