Link Search Menu Expand Document

Quick start 🚀

First, don’t forget include and namespace

#include "StraightforwardNeuralNetwork/src/neural_network/StraightforwardNeuralNetwork.hpp"
#include "StraightforwardNeuralNetwork/src/data/Data.hpp"
using namespace snn;

After, you just need to follow this 5 basic steps.

  1. Prepare you data
  2. Design the neural network
  3. Train the neural network
  4. Use it
  5. Save and load (Optional)

Prepare you data

Create a Data object, choose your problem type classification, multipleClassification or regression.

Data data(problem::classification, inputData, expectedOutputs);

Design the neural network

Create a StraightforwardNeuralNetwork object, choose the architecture using the layers.

StraightforwardNeuralNetwork neuralNetwork({
    Input(28, 28, 1), 
    Convolution(1, 3, activation::ReLU),
    FullyConnected(70, activation::tanh),
    FullyConnected(10, activation::sigmoid)
});

Train the neural network

Train the neural network and wait until the neural network has learned.

neuralNetwork.train(data, 20_s || 0.9_acc);

Use it

Use the neural networks to predict or calculate the class of new data.

vector<float> output = neuralNetwork.computeOutput(input); // for regression and multiple classification

or

int classNumber = neuralNetwork.computeCluster(input); // for classification

Save and load (Optional)

neuralNetwork.SaveAs(".\MyFirstNeuralNetwork.snn");
neuralNetwork.LoadFrom(".\MyFirstNeuralNetwork.snn");