puffpastry

Crates.iopuffpastry
lib.rspuffpastry
version0.1.0
sourcesrc
created_at2023-07-17 18:01:37.878672
updated_at2023-07-17 18:01:37.878672
descriptionbasic rust neural network framework
homepage
repositoryhttps://github.com/uek-1/puffpastry
max_upload_size
id918727
size53,278
Vivek Kethineni (uek-1)

documentation

README

puffpastry

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

// from_layers(layers: Vec<impl Layer, loss: Loss) -> Model
let mut model : Model<f64> = Model::from_layers(vec![
        Dense::from_size(2, 2, Activation::Sigmoid),
        Dense::from_size(2, 1, Activation::None)
    ],
    Loss::MeanSquaredError
);

let train_inputs = vec![
    Tensor::column(vec![0.0, 0.0]),
    Tensor::column(vec![1.0, 0.0]),
    Tensor::column(vec![0.0, 1.0]),
    Tensor::column(vec![1.0, 1.0]),
];

let train_outputs = vec![
    Tensor::column(vec![0.0]),
    Tensor::column(vec![1.0]),
    Tensor::column(vec![1.0]),
    Tensor::column(vec![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::column(vec![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]

Roadmap

  1. Convulational Layers (Layer rework in general) [75%]
  2. Documentation
  3. Tools to build GANs
Commit count: 59

cargo fmt