Git Product home page Git Product logo

puzzlebox.neuralnets's Introduction

PuzzleBox.NeuralNets

Build Status

This library is in beta.

PuzzleBox.NeuralNets is a .NET library for building and training neural networks. It's designed mainly to be easy to use and extend. The features are prioritised according to the needs of another project, for analysing the audio of bee hives.

It was inspired by the fluent interface of ConvNetSharp, a port of ConvNetJS, but I wanted transposed convolutional layers which ConvNetSharp didn't support at the time. I found other libraries overly difficult to learn and use, and I wanted a deeper understanding of neural networks which is why I decided to write this library.

Examples

XOR

// Build
var net = new Net(2)  // Input size 2
    .Dense(2)         // Fully-connected layer with output size 2
    .Sigmoid()
    .Dense(1)         // Fully-connected layer with output size 1
    .Sigmoid();

// Train
var trainingData = new (Tensor input, Tensor output)[]
    {
        (new float[] { 0, 0 }, 0),
        (new float[] { 0, 1 }, 1),
        (new float[] { 1, 0 }, 1),
        (new float[] { 1, 1 }, 0),
    };

var trainer = new Trainer(net, 0.15f);
var cost = await trainer.TrainAsync(10000, trainingData);

// Run
var output = net.FeedForwards(input);

XOR

More Complex Example

This example is more involved than a truth table with values between 0 and 1 forming a circular shape.

More Complex Example

CNN Autoencoder

var net = new Net(5, 5)                        // Input size 5x5
    .Convolution(new [] { 3, 3 }, 2)           // Two 3x3 kernels
    .Relu()
    .Dense(new Size(new [] { 1, 1 }))          // Compress input to single value
    .Relu()
    .ConvolutionTranspose(new[] { 5, 5 }, 2)   // Two 5x5 kernels
    .Sigmoid()
    .Dense(new Size(new[] { 5, 5 }))
    .Sigmoid();

Current Features

  • Layers
    • Dense
    • Convolution
    • Transpose Convolution
  • Activation functions
    • Sigmoid
    • TanH
    • Relu
  • Cost functions:
    • Squared error
    • Cross entropy

Possible Features

  • Layers
    • CNN with bias
    • N-dimensional CNN
    • Transformer

puzzlebox.neuralnets's People

Contributors

jasonkstevens avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.