Open 3D Engine MachineLearning Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
MachineLearning::MultilayerPerceptron Class Reference

This is a basic multilayer perceptron neural network capable of basic training and feed forward operations. More...

#include <MultilayerPerceptron.h>

Inherits MachineLearning::INeuralNetwork.

Public Member Functions

 AZ_RTTI (MultilayerPerceptron, "{E12EF761-41A5-48C3-BF55-7179B280D45F}", INeuralNetwork)
 
 MultilayerPerceptron (const MultilayerPerceptron &)
 
 MultilayerPerceptron (AZStd::size_t activationCount)
 
MultilayerPerceptronoperator= (const MultilayerPerceptron &)
 
MultilayerPerceptronoperator= (const ModelAsset &)
 
void AddLayer (AZStd::size_t layerDimensionality, ActivationFunctions activationFunction=ActivationFunctions::ReLU)
 Adds a new layer to the model.
 
LayerGetLayer (AZStd::size_t layerIndex)
 Retrieves a specific layer from the model, this is not thread safe and should only be used during unit testing to validate model parameters.
 
AZStd::string GetName () const override
 
AZStd::string GetAssetFile (AssetTypes assetType) const override
 
AZStd::size_t GetInputDimensionality () const override
 Returns the number of input neurons the model supports.
 
AZStd::size_t GetOutputDimensionality () const override
 Returns the number of output neurons the model supports.
 
AZStd::size_t GetLayerCount () const override
 Returns the total number of layers in the network.
 
AZ::MatrixMxN GetLayerWeights (AZStd::size_t layerIndex) const override
 
AZ::VectorN GetLayerBiases (AZStd::size_t layerIndex) const override
 
AZStd::size_t GetParameterCount () const override
 Returns the total number of parameters in the neural network.
 
IInferenceContextPtr CreateInferenceContext () override
 
ITrainingContextPtr CreateTrainingContext () override
 
const AZ::VectorN * Forward (IInferenceContextPtr context, const AZ::VectorN &activations) override
 
void Reverse (ITrainingContextPtr context, LossFunctions lossFunction, const AZ::VectorN &activations, const AZ::VectorN &expected) override
 
void GradientDescent (ITrainingContextPtr context, float learningRate) override
 
bool LoadModel () override
 Loads the current model parameters from the associated asset file.
 
bool SaveModel () override
 Saves the current model parameters to the associated asset file.
 
- Public Member Functions inherited from MachineLearning::INeuralNetwork
 AZ_RTTI (INeuralNetwork, "{64E5B5B1-4A7D-489D-9A29-D9510BB7E17A}")
 
 INeuralNetwork (INeuralNetwork &&)=default
 
 INeuralNetwork (const INeuralNetwork &)=default
 
INeuralNetworkoperator= (INeuralNetwork &&)=default
 
INeuralNetworkoperator= (const INeuralNetwork &)=default
 
virtual AZStd::string GetAssetFile ([[maybe_unused]] AssetTypes assetType) const
 Returns the file where model parameters are stored.
 
virtual AZ::MatrixMxN GetLayerWeights ([[maybe_unused]] AZStd::size_t layerIndex) const
 Returns the weight matrix for the requested layer.
 
virtual AZ::VectorN GetLayerBiases ([[maybe_unused]] AZStd::size_t layerIndex) const
 Returns the weight matrix for the requested layer.
 
virtual const AZ::VectorN * Forward ([[maybe_unused]] IInferenceContextPtr context, [[maybe_unused]] const AZ::VectorN &activations)
 Performs a basic feed-forward operation to compute the output from a set of activation values.
 
virtual void Reverse ([[maybe_unused]] ITrainingContextPtr context, [[maybe_unused]] LossFunctions lossFunction, [[maybe_unused]] const AZ::VectorN &activations, [[maybe_unused]] const AZ::VectorN &expected)
 Accumulates the loss gradients given a loss function, an activation vector and a corresponding label vector.
 
virtual void GradientDescent ([[maybe_unused]] ITrainingContextPtr context, [[maybe_unused]] float learningRate)
 Performs a gradient descent step and resets all gradient accumulators to zero.
 
void add_ref ()
 
void release ()
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Friends

class MultilayerPerceptronEditorComponent
 

Detailed Description

This is a basic multilayer perceptron neural network capable of basic training and feed forward operations.

Member Function Documentation

◆ GetName()

AZStd::string MachineLearning::MultilayerPerceptron::GetName ( ) const
overridevirtual

INeuralNetwork interface

Reimplemented from MachineLearning::INeuralNetwork.

◆ Reflect()

static void MachineLearning::MultilayerPerceptron::Reflect ( AZ::ReflectContext *  context)
static

AzCore Reflection.

Parameters
contextreflection context

The documentation for this class was generated from the following file: