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 CatBoost
import numpy as np

train_data = np.random.randint(1, 100, size=(100, 10))
train_labels = np.random.randint(2, size=(100))

model = CatBoost()

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)