fonet is a deep neural network package for Go.

Overview

fonet

Build Status Go Report Card GoDoc

fonet is a deep neural network package for Go. It's mainly created because I wanted to learn about neural networks and create my own package. I'm planning to continue the development of the package and add more function to it, for example exporting/importing a model.

Install

It's the same as everywhere, you just have to run the

go get github.com/Fontinalis/fonet

Usage

I focused (and still focusing) on creating an easy to use package, but let me know if something is not clear.

Creating a network

As in the xor example, it's not so complicated to create a network. When you creating the network, you always have to define the layers.

n := fonet.NewNetwork([]int{2, 3, 1})
/*
2 nodes in the INPUT LAYER
3 nodes in the HIDDEN LAYER
1 node in the OUTPUT LAYER
*/

But my goal was also to create a package, which can create deep neural networks too, so here is another example for that.

n := fonet.NewNetwork([]int{6, 12, 8, 4})
/*
6 nodes in the INPUT LAYER
12 nodes in the HIDDEN LAYER (1)
8 nodes in the HIDDEN LAYER (2)
4 nodes in the OUTPUT LAYER
*/

Train the network

After creating the network, you have to train your network. To do that, you have to specify your training set, which should be like the next

var trainingData = [][][]float64{
    [][]float64{ // The actual training sample
        []float64{
            /*
            The INPUT data
            */
        },
        []float64{
            /*
            The OUTPUT data
            */
        },
    },
}

After giving the training data, you can set the epoch and the learning rate.

n.Train(trainingData, epoch, lrate, true)
// Train(trainingData [][][]float64, epochs int, lrate float64, debug bool)

Note: When 'debug' is true, it'll show when and which epoch is finished

Predict the output

After training your network, using the Predict(..) function you can calculate the output for the given input.

In the case of XOR, it looks like the next

input := []float64{
    1,
    1,
}
out := n.Predict(input)
Issues
  • New activation functions

    New activation functions

    Partial work towards #2

    • Added framework for supporting other activation functions
    • Added activation and derivative functions (used formula from https://en.wikipedia.org/wiki/Activation_function - however these did not pass tests, so those tests are currently commented out)
    • Added more tests (coverage ~86%) - will be nearing 100% when the added activation functions are testable
    • Removed broken badge from README
    • Improved comments/docs and some coding style issues
    • Added Load function and moved old Load to LoadFrom, to allow reading from io.Reader
    • Network now implements the json.Unmarshal and json.Marshal interfaces

    This PR has non-backwards compatible changes, as the repo is <v1.0 should be OK.

    This PR has quite a few commented out tests; I do not know if further changes are required to the logic of the NN functions to make the new activation/derivative functions work. All uncommented tests work, meaning the repo will build again.

    opened by bcvery1 4
  • Travis.org closing

    Travis.org closing

    Please be aware of the following warning on Travis.org:

    Please be aware travis-ci.org will be shutting down by end of May 2021. Please consider migrating to travis-ci.com.
    
    opened by bcvery1 3
  • Fixing build and report card

    Fixing build and report card

    Changes:

    • Added a project folder to .gitignore so GoLand project files are ignored
    • Initial commit of go.mod
    • Added all missing function docs, including fixing a malformed comment
    • Fixed signatures for all examples so Travis builds pass

    Travis builds are green with this build, and report card is A+

    Resolves #5

    opened by bcvery1 1
  • Build and vetting failing

    Build and vetting failing

    Examples and README examples need updating to fix Travis builds, and a few other function docs need changing in order to raise report card back to A+

    Will be raising a PR for this

    opened by bcvery1 0
  • output is NaN

    output is NaN

    /*Geometric sequence / func PrepareTrainingData_dengbishulie(n int) [][][]float64 { traindatas := make([][][]float64,0) for i:=0;i<n;i++{ for j:=0;j<n;j++{ traindatas = append(traindatas,[][]float64{[]float64{float64(i),float64(j)},[]float64{float64(ij)}}) } } fmt.Printf("%++v",traindatas) return traindatas }

    /main/ n,err := fonet.NewNetwork([]int{2, 1, 1},fonet.LeakyReLU) if err != nil { panic(err.Error()) } trainingdata := PrepareTrainingData_dengbishulie(10)

    n.Train(trainingdata,100,0.95,true)
    fmt.Println(n.Predict([]float64{2,6}))
    

    ------output is NaN why???

    opened by leeningli 0
  • Outputs only between 0 and 1

    Outputs only between 0 and 1

    I'm trying to work out if this is intended behaviour, whatever data I train a network with, the output is always between 0 and 1, even if that does not match the training data.

    Please see #1 as further explanation.

    Have I misunderstood the scope of the networks? Is this behaviour expected? If I needed a network which was able to output a float of arbitrary size, is this possible with this package?

    Many thanks

    opened by bcvery1 2
Releases(v0.2.0)
Owner
Barnabás Pataki
Barnabás Pataki
Artificial Neural Network

go-deep Feed forward/backpropagation neural network implementation. Currently supports: Activation functions: sigmoid, hyperbolic, ReLU Solvers: SGD,

Patrik Ehrencrona 365 May 15, 2022
Neural Network for Go.

gonet gonet is a Go module implementing multi-layer Neural Network. Install Install the module with: go get github.com/dathoangnd/gonet Import it in

Dat Hoang 74 Apr 21, 2022
onnx-go gives the ability to import a pre-trained neural network within Go without being linked to a framework or library.

This is a Go Interface to Open Neural Network Exchange (ONNX). Overview onnx-go contains primitives to decode a onnx binary model into a computation b

Olivier Wulveryck 388 May 1, 2022
Golang Neural Network

Varis Neural Networks with GO About Package Some time ago I decided to learn Go language and neural networks. So it's my variation of Neural Networks

Artem Filippov 44 Mar 20, 2022
A neural network library built in Go

go-mind A neural network library built in Go. Usage import "github.com/stevenmiller888/go-mind" m := mind.New(0.7, 10000, 3, "sigmoid") m.Learn([][]

Steven Miller 165 Mar 16, 2022
Example of Neural Network models of social and personality psychology phenomena

SocialNN Example of Neural Network models of social and personality psychology phenomena This repository gathers a collection of neural network models

null 6 Jan 15, 2022
Neural network in Go

network Package network is a simple implementation of a nonbiased neural network. The networks created by this package can be trained with backpropaga

Shingirai Chanakira 0 Nov 25, 2021
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

Spice.ai 722 May 10, 2022
Neural Networks written in go

gobrain Neural Networks written in go Getting Started The version 1.0.0 includes just basic Neural Network functions such as Feed Forward and Elman Re

Go Machine Learning 522 May 3, 2022
An implementation of Neural Turing Machines

Neural Turing Machines Package ntm implements the Neural Turing Machine architecture as described in A.Graves, G. Wayne, and I. Danihelka. arXiv prepr

Fumin 397 Apr 4, 2022
Implementation of E(n)-Equivariant Graph Neural Networks, in Pytorch

EGNN - Pytorch Implementation of E(n)-Equivariant Graph Neural Networks, in Pytorch. May be eventually used for Alphafold2 replication.

Phil Wang 201 May 15, 2022
A multilayer perceptron network implemented in Go, with training via backpropagation.

Neural Go I'm in the process of making significant changes to this package, particularly, to make it more modular, and to base it around an actual lin

Schuyler Erle 63 Mar 5, 2022
Generative Adversarial Network in Go via Gorgonia

Generative adversarial networks Recipe for simple GAN in Golang ecosystem via Gorgonia library Table of Contents About Why Instruments Usage Code expl

Dimitrii Lopanov 72 Feb 22, 2022
Tpu-traffic-classifier - This small program creates ipsets and iptables rules for nodes in the Solana network

TPU traffic classifier This small program creates ipsets and iptables rules for

Triton One 7 May 16, 2022
Go package for OCR (Optical Character Recognition), by using Tesseract C++ library

gosseract OCR Golang OCR package, by using Tesseract C++ library. OCR Server Do you just want OCR server, or see the working example of this package?

Hiromu OCHIAI 1.8k May 15, 2022
This package provides manipulations for bit-packed k-mers

kmers This package provides manipulations for bit-packed k-mers (k<=32, encoded in uint64). Related projects: unik provides k-mer serialization method

Wei Shen 2 Nov 8, 2021
The DGL Operator makes it easy to run Deep Graph Library (DGL) graph neural network training on Kubernetes

DGL Operator The DGL Operator makes it easy to run Deep Graph Library (DGL) graph neural network distributed or non-distributed training on Kubernetes

Qihoo 360 40 Apr 28, 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

Raven 1 Dec 2, 2021
💁‍♀️Your new best friend powered by an artificial neural network

??‍♀️ Your new best friend Website — Documentation — Getting started — Introduction — Translations — Contributors — License ⚠️ Please check the Call f

Olivia 3.2k May 10, 2022
Artificial Neural Network

go-deep Feed forward/backpropagation neural network implementation. Currently supports: Activation functions: sigmoid, hyperbolic, ReLU Solvers: SGD,

Patrik Ehrencrona 365 May 15, 2022
Neural Network for Go.

gonet gonet is a Go module implementing multi-layer Neural Network. Install Install the module with: go get github.com/dathoangnd/gonet Import it in

Dat Hoang 74 Apr 21, 2022
onnx-go gives the ability to import a pre-trained neural network within Go without being linked to a framework or library.

This is a Go Interface to Open Neural Network Exchange (ONNX). Overview onnx-go contains primitives to decode a onnx binary model into a computation b

Olivier Wulveryck 388 May 1, 2022
Golang Neural Network

Varis Neural Networks with GO About Package Some time ago I decided to learn Go language and neural networks. So it's my variation of Neural Networks

Artem Filippov 44 Mar 20, 2022
A neural network library built in Go

go-mind A neural network library built in Go. Usage import "github.com/stevenmiller888/go-mind" m := mind.New(0.7, 10000, 3, "sigmoid") m.Learn([][]

Steven Miller 165 Mar 16, 2022
Example of Neural Network models of social and personality psychology phenomena

SocialNN Example of Neural Network models of social and personality psychology phenomena This repository gathers a collection of neural network models

null 6 Jan 15, 2022
A command-line tool that uses a fake AI neural network to tell whether or not Ben is sus

Is ben sus? Let's use an AI neural network, trained by his own tweets to figure out. A command-line tool that uses a fake AI neural network to tell wh

Levi Richardson 2 Jan 7, 2022
Neural network in Go

network Package network is a simple implementation of a nonbiased neural network. The networks created by this package can be trained with backpropaga

Shingirai Chanakira 0 Nov 25, 2021
Gopher-ml - Simple neural network built in go

Building a neural network from scratch with Golang Simply neural network built i

Abdulaziz Sirojiddinov 0 Jan 10, 2022
Extremely flexible golang deep comparison, extends the go testing package and tests HTTP APIs

go-testdeep Extremely flexible golang deep comparison, extends the go testing package. Latest news Synopsis Description Installation Functions Availab

Maxime Soulé 279 May 11, 2022