set_scale_and_bias

Set the scale and bias.

Method call format

set_scale_and_bias(scale, bias)

Parameters

scale

Description

The model scale.

The model prediction results are calculated as follows:
leaf_valuesscale+bias\sum leaf\_values \cdot scale + bias��

The value of this parameters affects the prediction by changing the default value of the scale.

Possible types

float

Default value

1

bias

Description

The model bias.

The model prediction results are calculated as follows:
leaf_valuesscale+bias\sum leaf\_values \cdot scale + bias��

The value of this parameters affects the prediction by changing the default value of the bias.

Possible types

float

Default value

Depends on the value of the --boost-from-average for the Command-line version parameter:

  • True — The best constant value for the specified loss function
  • False — 0

Examples

from catboost import CatBoostRegressor, Pool
import numpy as np

train_data = [[1, 4, 5, 6],
              [4, 5, 6, 7],
              [30, 40, 50, 60]]

eval_data = [[2, 4, 6, 8],
             [1, 4, 50, 60]]

train_labels = [10, 20, 30]

model = CatBoostRegressor()

print("Default scale and bias: " + str(model.get_scale_and_bias()))
model.set_scale_and_bias(0.5, 0.5)
print("Modified scale and bias: " + str(model.get_scale_and_bias()))

The output of this example:

Default scale and bias: (1.0, 0.0)
Modified scale and bias: (0.5, 0.5)
Previous
Next