Incremental Classification Kernel Predict — Machine Learning/Incremental Learning
Machine_Learning/Incremental_Learning/Incremental_Classification_Kernel_Predict · 2 input / 2 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++
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.
Incremental Classification Kernel Predict
Machine Learning / Incremental Learning
Predicts with an online binary kernel classifier: reads the model bus an Incremental Classification Kernel Fit block puts out, expands x through the same random feature map, and gives the label and the two class scores. The raw score is f = z(xs)·β + b, with xs the predictors standardized by the bus's Mu and Sigma and z the Fastfood expansion (see the Fit block); f ≥ 0 predicts the second class. This is Simulink's IncrementalClassificationKernel Predict block (Statistics and Machine Learning Toolbox).
Ports
- mdl (
bus) – the model, from an Incremental Classification Kernel Fit block: Beta [D,1], Bias, IsWarm, CanPredict, Mu [P,1], Sigma [P,1], MajorityClass and Prior. A bus of any other shape is refused when the model is built. - x – one observation of the P predictors, a row [1,P].
- label – the predicted class, [1,1], one of Class Names: the second when f ≥ 0, the first otherwise. While the bus's CanPredict is false (standardization still being estimated) it is the bus's MajorityClass.
- score – the two class scores, [1,2]: [−f, f] for the svm learner, and the logistic probabilities [1/(1+ef), 1/(1+e−f)] for the logistic learner. While CanPredict is false f is taken as 0, so the scores are [0, 0] or [0.5, 0.5].
Parameters
- Class Names – the two class labels, [0 1] by default; the Fit block's.
- Learner – svm (the default) or logistic, the Fit block's: it decides the score transform.
- Num Expansion Dimensions – D, the number of expanded features and the length of the bus's Beta; 16 by default, at most 256.
- Kernel Scale – the learner's
KernelScale, a positive number. 1 by default. - Feature Map S, Feature Map G, Feature Map B and
Feature Map P – the learner's random Fastfood map, four [b,o]
matrices (o = 2ceil(log2 P), b = ceil(D/(2o))), from
s = toStruct(Mdl.Impl.FeatureMapper). They must be the Fit block's: the map is the learner's constant half and is not on the bus, so this block carries its own copy, as Simulink's Predict block reads the same InitialLearner as its Fit block. The defaults are the Fit block's defaults. - Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
When a run is refused
An x that is not a row, a Class Names that is not two different numbers, more than 8 predictors, a feature map that does not fit P and D, or a bus that is not the shape P and D imply.
Code export
Six targets: Python, MATLAB, Java, Rust, C and C++, reading the bus's elements by name and writing the feature map out feature by feature, which is why D is capped. The hardware targets (VHDL, Verilog, SystemVerilog) and PLC Structured Text carry no bus, so an export to one stops and names the block.
Simulink bridge
None. Simulink's block takes its learner as InitialLearner, the name of an incrementalClassificationKernel object in the MATLAB workspace, rather than as dialog parameters, so there is nothing in its dialog to map these configs onto or read them back from.
Notes
- Algebraic, with no state: the output depends only on this step's bus and x.
- NaN in x makes the output NaN.
- Verified against R2026a, by the
incremental_kernel_learnersregression suite: behind an Incremental Classification Kernel Fit block, over 120 steps in four configurations (svm and logistic, with and without standardization), the label and both scores agree with Simulink's Predict block within 10−11 at every checkpoint, including the steps where CanPredict is still false.
Code facts#
| Fact | Value |
|---|---|
| registered type | Machine_Learning/Incremental_Learning/Incremental_Classification_Kernel_Predict |
| family | Machine_Learning/Incremental_Learning |
| solver environment class | ICoreBlock_0_Machine_Learning_1_Incremental_Learning_2_Incremental_Classification_Kernel_Predict |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Machine_Learning/Incremental_Learning/Incremental_Classification_Kernel_Predict/ICoreBlock_0_Machine_Learning_1_Incremental_Learning_2_Incremental_Classification_Kernel_Predict.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Machine_Learning/Incremental_Learning/Incremental_Classification_Kernel_Predict/ICoreBlock_0_Machine_Learning_1_Incremental_Learning_2_Incremental_Classification_Kernel_Predict.h |
| default size on canvas | 150 × 80 px |
| ports at insert | 2 in, 2 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++ |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | in | ICoreBus | mdl |
| 2 | in | ICoreDouble | x |
| 3 | out | ICoreDouble | label |
| 4 | out | ICoreDouble | score |
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 |
|---|---|---|
Class Names | [0 1] | — |
Learner | svm%~%logistic~~svm | — |
Num Expansion Dimensions | ICoreIncrementalKernel::DEFAULT_EXPANSION | — |
Kernel Scale | ICoreIncrementalKernel::DEFAULT_KERNEL_SCALE | — |
Feature Map S | ICoreIncrementalKernel::DEFAULT_S | — |
Feature Map G | ICoreIncrementalKernel::DEFAULT_G | — |
Feature Map B | ICoreIncrementalKernel::DEFAULT_B | — |
Feature Map P | ICoreIncrementalKernel::DEFAULT_P | — |
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 | statsIncremental/Classification/Kernel/IncrementalClassificationKernel Predict |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Caveat (shown to the user): no bridge: Simulink's IncrementalClassificationKernel Predict block takes its learner as InitialLearner, the NAME of an incrementalClassificationKernel object in the MATLAB workspace, not as dialog parameters -- there is nothing in its dialog to map the configs or the feature map onto, or read them back from
Catalog contract: src/ICoreBlocks/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).
IncrementalClassificationKernel Predict -- the predict half of an online kernel classifier statsIncremental/Classification/Kernel/IncrementalClassificationKernel Predict, MEASURED on R2026a 2026-10-02 (BLOCKS_TO_ADD_TOOLBOXES.md statsIncremental, on FEATURES_TO_ADD.md BF1). It reads Beta, Bias, CanPredict, Mu and Sigma, MajorityClass off the bus an Incremental_Classification_Kernel_Fit block writes, standardizes x by that Mu and Sigma, expands it through the learner's Fastfood map (which never rides on the bus, so it is a config here as on the Fit block) and takes f = z . Beta + Bias. While CanPredict is false f is 0, as Simulink's block answers then; the label is then MajorityClass's class.
Sample results#
No stimulus produced a sampled output in this rig — Invalid input size at Incremental Classification Kernel Predict block: ICore Blocks/Home/Incremental Classification Kernel Predict. The input carries 1 predictors, so the learner's Hadamard order must be 2^ceil(log2(1)) = 1, but the feature maps have 4 columns. The learner was made for a different number of predictors.. 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 9bb07c6c1 · produced by docsSample --out <folder> --blocks Incremental_Regression_Kernel_Fit Incremental_Classification_Kernel_Fit Incremental_Regression_Kernel_Predict Incremental_Classification_Kernel_Predict Per_Observation_Loss --steps 60
Sample data: docs/generated/samples/Machine_Learning__Incremental_Learning__Incremental_Classification_Kernel_Predict.json