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 CatBoostClassifier, Pool
import numpy as np

train_data = Pool(data=[[1, 4, 5, 6],
                        [4, 5, 6, 7],
                        [30, 40, 50, 60]],
                  label=[1, 1, -1],
                  weight=[0.1, 0.2, 0.3])

model = CatBoostClassifier()

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)