OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
OpenNN API Reference

OpenNN is a high-performance C++ library for advanced analytics built around neural networks. This is the API reference; for tutorials and step-by-step guides please visit opennn.net.

The library is developed by Artelnics. The source code lives at github.com/Artelnics/OpenNN.

Core classes

A typical OpenNN program revolves around five classes that work together:

Class Role
Dataset Data loading, partitioning, scaling, statistics
NeuralNetwork Architecture definition and layer management
TrainingStrategy Pairs an optimizer with a loss and runs training
ModelSelection Hyperparameter and architecture search
TestingAnalysis Model evaluation on held-out data

Layer types

Dense, DenseRelu, Convolutional, ConvolutionalRelu, Pooling, Pooling3d, Recurrent, Embedding, MultiHeadAttention, Normalization3d, Scaling, Unscaling, Bounding, Addition, Flatten.

Optimizers

AdaptiveMomentEstimation (Adam), StochasticGradientDescent (SGD), QuasiNewtonMethod (BFGS), LevenbergMarquardtAlgorithm.

First program

The example below loads iris.csv, builds a small MLP for regression and trains it with Adam. See ApproximationNetwork for the architecture used here.

#include "opennn/dataset.h"
using namespace opennn;
int main()
{
// 1. Load and partition the data.
Dataset data("iris.csv", ",", /*has_header=*/true);
// 2. Build a 4-input, hidden(3), 3-output approximation MLP.
ApproximationNetwork network({4}, {3}, {3});
// 3. Pair the network with the data, choose an optimizer and a loss.
TrainingStrategy training_strategy(&network, &data);
training_strategy.set_optimization_algorithm("AdaptiveMomentEstimation");
training_strategy.set_loss("MeanSquaredError");
// 4. Train.
training_strategy.train();
return 0;
}
Standard regression (function approximation) MLP.
Definition standard_networks.h:38
Base data container with samples, variables and per-variable metadata.
Definition dataset.h:108
Coordinates the training of a NeuralNetwork on a Dataset.
Definition training_strategy.h:45
Declares the Dataset class and the SampleRole enum.
Definition adaptive_moment_estimation.h:19
Declares ready-made NeuralNetwork architectures for common learning tasks (regression,...
Declares the TrainingStrategy class.

Navigating the reference

Resources