# `StreamingGradientBoostedRegression`

### *class* capymoa.regressor.StreamingGradientBoostedRegression[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/regressor/_sgbr.py#L12)

Bases: [`MOARegressor`](capymoa.base.MOARegressor.md#capymoa.base.MOARegressor)

Streaming Gradient Boosted Regression.

Streaming Gradient Boosted Regression (SGBR) <sup>[1](#id2)</sup>, was developed to adapt gradient boosting for streaming regression
using Streaming Gradient Boosted Trees (SGBT). A variant called SGB(Oza), which uses OzaBag bagging regressors as
base learners, outperforms existing state-of-the-art methods in both accuracy and efficiency across various drift
scenarios.

```pycon
>>> from capymoa.datasets import Fried
    >>> from capymoa.regressor import StreamingGradientBoostedRegression
    >>> from capymoa.evaluation import prequential_evaluation
>>> stream = Fried()
>>> schema = stream.get_schema()
>>> learner = StreamingGradientBoostedRegression(schema)
>>> results = prequential_evaluation(stream, learner, max_instances=1000)
>>> round(results["cumulative"].r2(), 2)
0.61
```

* <a id='id2'>**[1]**</a> [Gradient boosted bagging for evolving data stream regression. Nuwan Gunasekara, Bernhard Pfahringer, Heitor Murilo Gomes, Albert Bifet. Data Mining and Knowledge Discovery, Springer, 2025.](https://doi.org/10.1007/s10618-025-01147-x)

#### \_\_init_\_(schema: [Schema](capymoa.stream.Schema.md#capymoa.stream.Schema) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, random_seed: [int](https://docs.python.org/3/builtins/functions.html#int) = 0, base_learner='meta.OzaBag -s 10 -l (trees.FIMTDD -s VarianceReductionSplitCriterion -g 50 -c 0.01 -e)', boosting_iterations: [int](https://docs.python.org/3/builtins/functions.html#int) = 10, percentage_of_features: [int](https://docs.python.org/3/builtins/functions.html#int) = 75, learning_rate=1.0, disable_one_hot: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, multiply_hessian_by: [int](https://docs.python.org/3/builtins/functions.html#int) = 1, skip_training: [int](https://docs.python.org/3/builtins/functions.html#int) = 1, use_squared_loss: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/regressor/_sgbr.py#L35)

Streaming Gradient Boosted Regression (SGBR) Regressor

* **Parameters:**
  * **schema** – The schema of the stream.
  * **random_seed** – The random seed passed to the MOA learner.
  * **base_learner** – The base learner to be trained. Default meta.OzaBag -s 10 -l (trees.FIMTDD -s VarianceReductionSplitCriterion -g 50 -c 0.01 -e).
  * **boosting_iterations** – The number of boosting iterations. Default 10.
  * **percentage_of_features** – The percentage of features to use.
  * **learning_rate** – The learning rate. Default 1.0.
  * **disable_one_hot** – Whether to disable one-hot encoding for regressors that supports nominal attributes.
  * **multiply_hessian_by** – The multiply hessian by this parameter to generate weights for multiple iterations.
  * **skip_training** – Skip training of 1/skip_training instances. skip_training=1 means no skipping is performed (train on all instances).
  * **use_squared_loss** – Whether to use squared loss for classification.

#### cli_help()[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/base/_regressor.py#L53)

#### *classmethod* from_params(schema: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None, params: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, random_seed: [int](https://docs.python.org/3/builtins/functions.html#int) = 1) → [Any](https://docs.python.org/3/library/typing.html#typing.Any)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/base/_learner_params.py#L170)

Construct an instance from parameters produced by `get_params`.

#### get_params() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)][[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/base/_learner_params.py#L163)

Return the hyper-parameters captured from the constructor.

#### predict(instance)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/base/_regressor.py#L59)

#### train(instance)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/base/_regressor.py#L56)
