Gaussian Process Predictor — Machine Learning/Classical Models
Machine_Learning/Classical_Models/Gaussian_Process_Predictor · 1 input / 2 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text
Description#
The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.
Gaussian Process Predictor
Machine Learning / Classical Models
A fitted Gaussian Process at inference. With k* the vector of kernel values between the input and the n training points: mean = k*·α and variance = σf2 − k*·K⁻¹·k*. The variance is the reason to want a GP in a controller – it is the one model in this library that says how much it does not know, growing back toward σf2 wherever the input leaves the training data.
Ports
- u – the feature vector, [d,1], where d is the number of columns of Training Inputs.
- mean – [1,1], the predictive mean k*·α.
- variance – [1,1], the predictive variance, or a constant 0 while Variance Output is Disabled.
Parameters
- Training Inputs – X, an [n,d] matrix, one training
point per row (scikit-learn's
X_train_). - Alpha – α = (K + σn2I)⁻¹y,
an [n,1] column: scikit-learn's
alpha_. - Inverse Gram – (K + σn2I)⁻¹, the [n,n] inverse of the regularized training Gram matrix. Invert it (or assemble it from the stored Cholesky factor) once, offline – no block body inverts a matrix. It must come from the same fit as Alpha: a Kinv fitted with a different kernel or length scale makes the variance quietly meaningless.
- Length Scale – ℓ, scalar, shared by all dimensions.
- Signal Variance – σf2, scalar.
- Kernel
- RBF – σf2·exp(−r² ÷2ℓ²), the default.
- Matern 5/2 – σf2·(1 + s + s²/3)·e⁻ʲ, s = √5·r÷ℓ.
- Matern 3/2 – σf2·(1 + s) ·e⁻ʲ, s = √3·r÷ℓ.
- Variance Output – Enabled computes the quadratic form; Disabled pins the second port to 0 and drops the form from exported code entirely (Inverse Gram is then ignored).
- Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. X, α, the inverse Gram and the derived kernel constants are baked as literals at full precision; nothing is tunable after export, because a fitted model is not something to retune on the target. The generated code grows with n (and with n² when the variance is enabled) – a GP deployed with hundreds of training points produces a large, flat core.
The three HDL targets are simulation-only real arithmetic – exp and sqrt have no Q16.16 datapath – quantizing at the port boundary. They are not offered as synthesizable.
Simulink bridge
None. Neither the Statistics and Machine Learning Toolbox nor the Deep Learning Toolbox is installed on this machine, so a bridge could not be run against a parity testbench even if one were written; base Simulink offers no fitted-GP block in any case. The bridge reports the block rather than dropping it silently.
Notes
- Algebraic and stateless: the output depends only on the current input.
- No state space: a kernel sweep is genuinely nonlinear, and a fabricated A/B/C/D would be false.
- The variance can brush 0 from above in double precision when the input sits exactly on a training point of a near-noiseless fit; it never goes meaningfully negative for a Kinv and Alpha taken from the same fit.
Code facts#
| Fact | Value |
|---|---|
| registered type | Machine_Learning/Classical_Models/Gaussian_Process_Predictor |
| family | Machine_Learning/Classical_Models |
| solver environment class | ICoreBlock_0_Machine_Learning_1_Classical_Models_2_Gaussian_Process_Predictor |
| source | src/ICoreSDK/ICoreBlockLibrary/Blocks/Machine_Learning/Classical_Models/Gaussian_Process_Predictor/ICoreBlock_0_Machine_Learning_1_Classical_Models_2_Gaussian_Process_Predictor.cpp |
| header | src/ICoreSDK/ICoreBlockLibrary/Blocks/Machine_Learning/Classical_Models/Gaussian_Process_Predictor/ICoreBlock_0_Machine_Learning_1_Classical_Models_2_Gaussian_Process_Predictor.h |
| default size on canvas | 130 × 90 px |
| ports at insert | 1 in, 2 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | in | ICoreDouble | u |
| 2 | out | ICoreDouble | mean |
| 3 | out | ICoreDouble | variance |
Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.
Configuration variables#
| Config variable | Default | Simulink parameter |
|---|---|---|
Training Inputs | [0.6 -0.4; -0.5 0.7] | — |
Alpha | [0.6111420976628767; -0.42842308861028133] | — |
Inverse Gram | 0.7770613118784886 -0.16799794836983695; -0.167997948369… | — |
Length Scale | 0.9 | — |
Signal Variance | 1.3 | — |
Kernel | RBF%~%Matern 5/2%~%Matern 3/2~~RBF | — |
Variance Output | Enabled%~%Disabled~~Enabled | — |
Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.
Simulink bridge#
| support | Support::None |
| Simulink path | — |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Caveat (shown to the user): no verifiable Simulink equivalent. Neither the Statistics and Machine Learning Toolbox nor the Deep Learning Toolbox is installed on this machine, so a bridge could not be run against a parity testbench even if one were written. Base Simulink offers no fitted Gaussian Process block in any case. Export the fitted alpha, inverse Gram and kernel constants from scikit-learn and paste them here
Catalog contract: [src/ICoreSDK/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h
Description vs code#
The checker has a blind spot here — it could not resolve something (a grouped port bullet, a computed config name), which is reported and never counted as a pass. A reader has to settle it:
B0every stimulus in the sample errored — cross-checks skipped
The verdict above is
tools/docs/check_block_descriptions.py(P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.
File banner (developer view)#
The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).
Gaussian Process Predictor — a fitted GP at inference: mean k*'.alpha, variance sigma_f^2 - k*'.Kinv.k*, with RBF / Matern 5/2 / Matern 3/2 kernels alpha = (K + sn^2 I)^-1 y and Kinv = (K + sn^2 I)^-1 are FITTED quantities and arrive as CONFIG -- this row's one hard rule is that no block body inverts a matrix, and none does: the block is n kernel evaluations, one dot product and one quadratic form.
⚠ The kernel selects a different emitted body (RBF has no sqrt; the Materns differ in their polynomial), so each is a MODE. Disabling the variance output drops the whole quadratic form from the emitted code -- also a mode.
⚠ The variance is THE reason this block exists (it is the one model in the family that says how much it does not know), and it only means anything if Kinv matches the SAME fitted kernel as alpha -- the description says so, and the three rig configs were each derived from a real fit of the same X/y (see the rig comments).
⚠ The three HDL targets are SIMULATION-ONLY real arithmetic (exp/sqrt have no Q16.16 datapath). They INLINE every kernel value where the other seven backends name locals, because a VHDL block body cannot declare a
real-- RBF_Layer's shape. The quadratic form therefore re-evaluates kernels per term; at rig scale (n = 4) that is 32 EXPs of straight-line simulation code, and a large n bloats the HDL text before it slows anything.
Sample results#
No stimulus produced a sampled output in this rig — Invalid input size at: ICore Blocks/Home/Gaussian Process Predictor. That is a fact about the single-block rig, not a verdict on the block: an offline batch fit, a block whose output only appears at onSolverFinish, or one that needs a driven environment cannot be exercised alone.
Category unsampled · sample time 0.1 · 60 steps · commit ccf005c8 · produced by docsSample --out <folder> --steps 60
Sample data: docs/generated/samples/Machine_Learning__Classical_Models__Gaussian_Process_Predictor.json