nirs4all.operators.models.meta module

Meta-model operator for stacking ensemble.

This module provides the MetaModel operator for building stacking ensembles that use predictions from previously trained models as input features.

The meta-model trains on out-of-fold (OOF) predictions from base models to prevent data leakage and overfitting.

Example

>>> from nirs4all.operators.models import MetaModel
>>> from sklearn.linear_model import Ridge
>>>
>>> pipeline = [
...     MinMaxScaler(),
...     KFold(n_splits=5),
...     PLSRegression(n_components=10),
...     RandomForestRegressor(n_estimators=100),
...     {"model": MetaModel(model=Ridge(), source_models="all")},
... ]