iPcNeuralNet Struct Reference
A property class implementing a feed-forward neural network. More...
#include <propclass/neuralnet.h>

Public Member Functions | |
virtual bool | CacheWeights (const char *scope, uint32 id) const =0 |
Saves the weightings to cache with an iCacheManager. | |
virtual csPtr< iCelNNWeights > | CreateEmptyWeights () const =0 |
Returns a new weights structure with the same size as the current one. | |
virtual const celData & | GetOutput (size_t index) const =0 |
Returns the value of one of the outputs. | |
virtual const csArray< celData > & | GetOutputs () const =0 |
Retrieves all the output values in one go. | |
virtual void | GetWeights (iCelNNWeights *out) const =0 |
Copies the weightings of the neural network into the structure provided. | |
virtual bool | LoadCachedWeights (const char *scope, uint32 id)=0 |
Loads the weightings from cache with an iCacheManager. | |
virtual void | Process ()=0 |
Runs one iteration through the network, reading the inputs and setting the outputs. | |
virtual void | SetActivationFunc (celNNActivationFunc *)=0 |
Sets the activation function of the neural network. | |
virtual void | SetComplexity (const char *name)=0 |
Sets the heuristic that will be used to set the sizes of each layer. | |
virtual void | SetInput (size_t index, const celData &value)=0 |
Sets the value of one of the inputs. | |
virtual void | SetInputs (const csArray< celData > &values)=0 |
Sets all the input values in one go. | |
virtual void | SetLayerSizes (const csArray< size_t > &sizes)=0 |
Manually set the number of nodes in each hidden layer. | |
virtual void | SetSize (size_t inputs, size_t outputs, size_t layers)=0 |
Sets the size of the neural network (number of inputs, outputs and hidden layers). | |
virtual bool | SetWeights (const iCelNNWeights *in)=0 |
Copies the weightings into the neural network from the given structure. | |
virtual bool | Validate ()=0 |
Returns true if the neural network is initialized and ready to use. |
Detailed Description
A property class implementing a feed-forward neural network.
The property class holds the following properties (add prefix "cel.property." to get a property ID):
- "inputs" (long) The number of inputs in the neural network.
- "outputs" (long) The number of outputs in the neural network.
- "layers" (long) The number of hidden layers in the neural network.
- "dispatch" (bool) If true, pcneuralnet_outputs messages will be sent.
And the following actions (add prefix "cel.action." or "cel.parameter." to get the ID of an action or parameter respectively):
- "SetComplexity" Sets the method to use to set the sizes of the layers. Add prefix "cel.complexity." to the heuristic name to get the param.
- "SetLayerSizes" Instead of SetComplexity, this sets the sizes of the layers manually. Parameters: "layer0"..."layerN" (longs).
- "SetActivationFunc" Sets the activation function in the neural network. Parameter: "func" (string). See iCelNNActivationFunc and its subclasses. This also sets the datatype of the inputs and outputs.
- "SetInputs" Sets the values of the inputs. Parameters: "input0"..."inputN" the values (N = "cel.property.inputs" - 1).
- "Process" Runs one iteration through the neural network, reading the inputs and setting the outputs. May send "pcneuralnet_outputs" message.
- "SaveCache" Saves the weightings to VFS path /cellib/cache/pcneuralnet. Parameters: "scope" (string), "id" (long). See iCacheManager in CS.
- "LoadCache" Loads the weightings from VFS path /cellib/cache/pcneuralnet. Parameters: "scope" (string), "id" (long). See iCacheManager in CS.
And can send the following message to the behaviour:
- "pcneuralnet_outputs" Sent after every call to "cel.action.process". Parameters: "output0"..."outputN" the output values from the neural network (N - "cel.property.outputs" - 1).
Definition at line 96 of file neuralnet.h.
Member Function Documentation
virtual bool iPcNeuralNet::CacheWeights | ( | const char * | scope, | |
uint32 | id | |||
) | const [pure virtual] |
Saves the weightings to cache with an iCacheManager.
virtual csPtr<iCelNNWeights> iPcNeuralNet::CreateEmptyWeights | ( | ) | const [pure virtual] |
Returns a new weights structure with the same size as the current one.
virtual const celData& iPcNeuralNet::GetOutput | ( | size_t | index | ) | const [pure virtual] |
Returns the value of one of the outputs.
Retrieves all the output values in one go.
virtual void iPcNeuralNet::GetWeights | ( | iCelNNWeights * | out | ) | const [pure virtual] |
Copies the weightings of the neural network into the structure provided.
virtual bool iPcNeuralNet::LoadCachedWeights | ( | const char * | scope, | |
uint32 | id | |||
) | [pure virtual] |
Loads the weightings from cache with an iCacheManager.
virtual void iPcNeuralNet::Process | ( | ) | [pure virtual] |
Runs one iteration through the network, reading the inputs and setting the outputs.
virtual void iPcNeuralNet::SetActivationFunc | ( | celNNActivationFunc * | ) | [pure virtual] |
Sets the activation function of the neural network.
virtual void iPcNeuralNet::SetComplexity | ( | const char * | name | ) | [pure virtual] |
Sets the heuristic that will be used to set the sizes of each layer.
Alternatively you can call SetLayerSizes to set the sizes manually.
Acceptable values for the name parameter are:
- "linear" (default) sizes progress linearly from inputs to outputs.
- "halfLinear" like linear but first layer is 50% of the number of inputs.
- "addHalfLinear" line linear but first layer is 150% the number of inputs.
virtual void iPcNeuralNet::SetInput | ( | size_t | index, | |
const celData & | value | |||
) | [pure virtual] |
Sets the value of one of the inputs.
Sets all the input values in one go.
virtual void iPcNeuralNet::SetLayerSizes | ( | const csArray< size_t > & | sizes | ) | [pure virtual] |
Manually set the number of nodes in each hidden layer.
Alternatively you can call SetComplexity to have the sizes set automatically according to the selected heuristic.
virtual void iPcNeuralNet::SetSize | ( | size_t | inputs, | |
size_t | outputs, | |||
size_t | layers | |||
) | [pure virtual] |
Sets the size of the neural network (number of inputs, outputs and hidden layers).
virtual bool iPcNeuralNet::SetWeights | ( | const iCelNNWeights * | in | ) | [pure virtual] |
Copies the weightings into the neural network from the given structure.
virtual bool iPcNeuralNet::Validate | ( | ) | [pure virtual] |
Returns true if the neural network is initialized and ready to use.
If it is not, then an attempt is made to initialize it, and the return value signifies success or failure of that attempt.
The documentation for this struct was generated from the following file:
- propclass/neuralnet.h
Generated for CEL: Crystal Entity Layer 1.4.1 by doxygen 1.7.1