|
| | DiscriminativePCLayer (int size, int nextSize, int batchSize=1, float learningRate=1e-6, float inferenceRate=0.1f, float precisionRate=0.01f, float lmbda=1e-2f, void(*act)(float *, size_t)=relu, void(*dAct)(float *, size_t, bool)=dRelu) |
| | Constructor for a Deepity Layer.
|
| | DiscriminativePCLayer (int size, int nextSize, int batchSize=1, float learningRate=1e-6, float inferenceRate=0.1f, float precisionRate=0.01f, float lmbda=1e-2f, ActivationType aType=ActivationType::RELU, ActivationType dType=ActivationType::dRELU) |
| | Constructor for a Deepity Layer, using a named ActivationType instead of raw function pointers.
|
| float | CalculateState () noexcept override |
| | Calculates the total network energy state.
|
| void | UpdateState () noexcept override |
| | Computes the state derivatives for inference.
|
| void | UpdateWeights () noexcept override |
| | Computes weight updates via gradient descent, with L2 weight decay.
|
| void | UpdatePrecision () noexcept |
| | Updates this layer's precision weighting based on the current prediction error.
|
| void | Flush () noexcept override |
| | Does nothing; exists for class extension.
|
| void | ResyncLogPrecision () noexcept |
| | Recomputes log of precision if it falls behind.
|
| void | ClampState (const std::vector< float > &inputData) noexcept |
| | Clamps the layer to the input data.
|
| void | UnclampState () noexcept |
| | Unclamps the layer to the input data.
|
| float * | GetBeliefs () noexcept override |
| | Returns beliefs.
|
| const float * | GetErrors () const noexcept override |
| | Returns errors.
|
| const float * | GetMu () const noexcept |
| | Returns this layer's outgoing prediction buffer.
|
| size_t | GetInputSize () const noexcept override |
| | Returns size (input size).
|
| size_t | GetOutputSize () const noexcept override |
| | Returns nextSize (output size).
|
| size_t | GetBatchSize () const noexcept override |
| | Returns batchSize.
|
| const float * | GetWeights () const noexcept |
| | Returns a read-only version of the stored weights.
|
| float * | GetWeights () noexcept |
| | Returns a mutable version of the stored weights.
|
| const float * | GetBiases () const noexcept |
| | Returns a read-only version of the stored biases.
|
| float * | GetBiases () noexcept |
| | Returns a mutable version of the stored biases.
|
| const float * | GetPrecisions () const |
| | Returns a read-only version of the stored precisions.
|
| float | GetLearningRate () const noexcept |
| | Returns the learning rate used for weight updates.
|
| float | GetInferenceRate () const noexcept |
| | Returns the inference rate used for state updates.
|
| float | GetPrecisionRate () const noexcept |
| | Returns the learning rate used for precision updates.
|
| float | GetLambda () const noexcept |
| | Returns the weight-decay (L2 regularization) coefficient.
|
| void | SetLearningRate (float lr) noexcept |
| | Sets the learning rate used for weight updates.
|
| void | SetInferenceRate (float ir) noexcept |
| | Sets the inference rate used for state updates.
|
| void | SetPrecisionRate (float pr) noexcept |
| | Sets the learning rate used for precision updates.
|
| void | SetLambda (float l) noexcept |
| | Sets the weight-decay (L2 regularization) coefficient.
|
| void | SetOptimizer (OptimizerType o) noexcept |
| | Selects the optimizer used for weight updates.
|
| void | SetLayerAbove (DiscriminativePCLayer *above) noexcept |
| | Ties this layer to one above it.
|
| void | SetLayerBelow (DiscriminativePCLayer *below) noexcept |
| | Ties this layer to one below it.
|
| void | ResetState () noexcept |
| | Resets 'z' (beliefs) to 0.
|
| const DiscriminativePCLayer & | GetLayerAbove () const noexcept |
| | Gets const pointer to layer above.
|
| const DiscriminativePCLayer & | GetLayerBelow () const noexcept |
| | Gets const pointer to layer below.
|
| void | RandomizeWeights (std::mt19937 &twister) noexcept |
| | Makes the weights W randomized to [0.0, 0.1] using an OpenMP-parallelized uniform real distribution.
|
| ActivationType | GetActivationType () const noexcept |
| | Returns this layer's configured activation type.
|
| ActivationType | GetDerivativeType () const noexcept |
| | Returns this layer's configured activation-derivative type.
|
| size_t | GetRequiredFloats () const noexcept |
| | Calculates exact float count required by this layer's architecture.
|
| void | BindMemory (MemoryArena &arena) |
| | Binds all tensor pointers to the contiguous memory block.
|
| void | ComputeMuOnly () noexcept |
| | Computes only mu (forward prediction), skipping error and energy computation entirely. Useful for callers that only need a forward pass through current weights (e.g. forward projection initialization) without the cost of the discarded error/energy values.
|
| virtual | ~Layer ()=default |
| virtual std::map< std::string, TensorDescriptor > | GetStateDict () const |
| | Returns a dictionary of this.
|
Represents a single layer in a Predictive Coding Network.
- To perform inference (prediction):
- Clamp the input data to the bottom layer's latent state (z).
- Enter a continuous loop across all layers, calling CalculateState() to compute the local prediction errors (e).
- Call UpdateState() to adjust the latent states (z) based on those errors.
- Repeat steps 2 and 3 until the states settle into an equilibrium (the energy is minimized and dz/dt approaches zero).
- Read the final predictions from the latent states of the desired layers.
- (For learning): Call UpdateWeights() on all layers simultaneously once the states have fully settled.