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;
}
Factory neural network preconfigured for regression / function approximation.
Definition standard_networks.h:18
Abstract base class for OpenNN datasets, owning samples, variables, and metadata.
Definition dataset.h:61
High-level orchestrator pairing a Loss with an Optimizer for a network/dataset.
Definition training_strategy.h:24
Definition adaptive_moment_estimation.h:14

Navigating the reference

Resources