Incremental Classification Linear Predict — Machine Learning/Incremental Learning
Machine_Learning/Incremental_Learning/Incremental_Classification_Linear_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 Linear Predict
Machine Learning / Incremental Learning
Classifies one observation with the binary linear model an IncrementalClassificationLinear Fit block puts on its bus. The raw score is f = xs·β + b, where xs is x standardized by the bus's Mu and Sigma; the label is the second class name when f ≥ 0 and the first otherwise, and the two classes' scores are [−f, f], passed through the logit 1/(1 + e−s) for the logistic learner. This is Simulink's IncrementalClassificationLinear Predict block (Statistics and Machine Learning Toolbox) with its score output shown.
Ports
- mdl (
bus) – the model bus of an IncrementalClassificationLinear Fit block with the same number of predictors: Beta, Bias, IsWarm, CanPredict, Mu, Sigma, MajorityClass and Prior. Beta, Bias, CanPredict, Mu, Sigma and MajorityClass are read. - x – one observation of the P predictors, a row [1,P].
- label – the predicted class name, [1,1]. While the bus's CanPredict is false it is the class MajorityClass names.
- score – the two classes' scores [1,2], in Class Names order; the scores of f = 0 while CanPredict is false.
Parameters
- Learner – the learner the Fit block trains, which decides the
score transform:
- svm (the default) – the scores are [−f, f];
- logistic – the scores are the logit of [−f, f], the two classes' probabilities.
- Class Names – the Fit block's two labels, [0 1] by default.
- 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, Class Names that are not two different numbers, or a bus that is not the shape an IncrementalClassificationLinear Fit block writes for x's width.
Code export
Six targets: Python, MATLAB, Java, Rust, C and C++, each reading the bus's elements and scoring in the live block's order. 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 incrementalClassificationLinear object in the MATLAB workspace, rather than as dialog parameters, so there is nothing in its dialog to map these configs onto.
Notes
- Algebraic and stateless: the outputs depend only on this step's bus and x.
- Class Names and Learner must match the Fit block's: the bus does not carry them, as Simulink's does not; each Simulink block reads them from its own learner object.
- Verified against R2026a: fed by its Fit block over 120 steps in four configurations, every label agrees with Simulink's block and the scores within 10−14.
Code facts#
| Fact | Value |
|---|---|
| registered type | Machine_Learning/Incremental_Learning/Incremental_Classification_Linear_Predict |
| family | Machine_Learning/Incremental_Learning |
| solver environment class | ICoreBlock_0_Machine_Learning_1_Incremental_Learning_2_Incremental_Classification_Linear_Predict |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Machine_Learning/Incremental_Learning/Incremental_Classification_Linear_Predict/ICoreBlock_0_Machine_Learning_1_Incremental_Learning_2_Incremental_Classification_Linear_Predict.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Machine_Learning/Incremental_Learning/Incremental_Classification_Linear_Predict/ICoreBlock_0_Machine_Learning_1_Incremental_Learning_2_Incremental_Classification_Linear_Predict.h |
| default size on canvas | 170 × 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 |
|---|---|---|
Learner | svm%~%logistic~~svm | — |
Class Names | [0 1] | — |
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/Linear/IncrementalClassificationLinear Predict |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Caveat (shown to the user): no bridge: Simulink's IncrementalClassificationLinear Predict block takes its learner as InitialLearner, the NAME of an incrementalClassificationLinear object in the MATLAB workspace, not as dialog parameters -- there is nothing in its dialog to map the configs onto
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).
IncrementalClassificationLinear Predict -- the label of one observation under a model on a bus statsIncremental/Classification/Linear/IncrementalClassificationLinear Predict, MEASURED on R2026a 2026-10-02 (BLOCKS_TO_ADD_TOOLBOXES.md statsIncremental, on FEATURES_TO_ADD.md BF1): two inputs, the model bus and x; outputs the label and, with ShowOutputScore on, the two classes' scores. The raw score is f = xs.Beta + Bias, x standardized by the bus's Mu and Sigma as MATLAB writes it, and the scores are [-f, f], through the logit 1/(1+exp(-s)) for the logistic learner. Measured rules:
- the label is the second class name when f >= 0 (a tie goes to the second), else the first;
- while the bus's CanPredict is false, f is taken as 0 and the label is the class the bus's
MajorityClass names. Against Simulink's block, fed by its Fit block, over 120 steps in four configurations: every label exact, scores within 1e-14.
The class names and the learner are configs, as Simulink's block reads them off its own InitialLearner: they are the constant half of the model, which the bus does not carry.
Sample results#
No stimulus produced a sampled output in this rig — Incorrect bus shape reaching port: ICore Blocks/Home/Incremental Classification Linear Predict/ICoreBus-In-0 requires { Beta: ICoreDouble [1x1], Bias: ICoreDouble [1x1], IsWarm: ICoreBool [1x1], CanPredict: ICoreBool [1x1], Mu: ICoreDouble [1x1], Sigma: ICoreDouble [1x1], MajorityClass: ICoreUInt8 [1x1], Prior: ICoreDouble [2x1] }, ICore Blocks/Home/Bus Creator/ICoreBus-Out-0 carries { a: ICoreDouble [1x1], b: ICoreDouble [1x1] }. 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 68af3e6d2 · produced by docsSample --out <folder> --blocks Incremental_Regression_Linear_Fit Incremental_Regression_Linear_Predict Incremental_Classification_Linear_Fit Incremental_Classification_Linear_Predict --steps 60
Sample data: docs/generated/samples/Machine_Learning__Incremental_Learning__Incremental_Classification_Linear_Predict.json