Giter Site home page Giter Site logo

puffpastry's Introduction

puffpastry

crates.io docs.rs

puffpastry is a very basic feedforward neuron network library with a focus on parity with mathematical representations. It can be used to create and train simple models.

Usage

puffpastry is used very similarly to keras - stack layers and fit to training data.

Learning XOR

let mut model : Model<f64> = Model::new(Loss::MeanSquaredError);

// Dense::from_size(input_neurons, output_neurons, activation) -> Dense
model.push_layer(Dense::from_size(2, 2, Activation::Sigmoid));
model.push_layer(Dense::from_size(2, 1, Activation::None));


let train_inputs = vec![
    tensor!([[0.0], [0.0]]),
    tensor!([[1.0], [0.0]]),
    tensor!([[0.0], [1.0]]),
    tensor!([[1.0], [1.0]]),
];

let train_outputs = vec![
    tensor!([[0.0]]),
    tensor!([[1.0]]),
    tensor!([[1.0]]),
    tensor!([[0.0]]),
];

// fit(&mut self, inputs, outputs, epochs, learning_rate) -> Result
model.fit(train_inputs, train_outputs, 100, 1.2).unwrap();  

// evaluate(&self, input: Tensor) -> Result<Tensor>
model.evaluate(&tensor!([[1.0], [0.0]]).unwrap();
// stdout: Tensor {shape: [1], data: [0.9179620463347642]}

Features

Activation functions: [softmax, relu, sigmoid, linear]
Loss functions: [categorical cross entropy, mean squared error]
Layers: [dense, conv2d, maxpool2d, flatten]

Roadmap

  1. Improve convolution layer performance
  2. Make variations more explicit i.e. CategoricalCrossentropy vs ClippedCategoricalCrossEntropy
  3. Documentation
  4. Add pptimizers, weight initializers
  5. Add more losses, layers, metrics

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.