View source on GitHub |
Configuration for dominance constraints in TFL canned estimators.
tfl.configs.DominanceConfig(
feature_name, dominance_type='monotonic'
)
You can specify how a feature dominantes another feature. Supported dominance
types (see tfl.layers.Lattice
and tfl.layers.Linear
for details):
'monotonic'
: Monotonic dominance constrains the function to require the effect (slope) in the direction of the dominant dimension to be greater than that of the weak dimension for any point in both lattice and linear models. Both dominant and weak dimensions must be monotonic. The constraint is guranteed to satisfy at the end of training for linear models, but might not be strictly satisified for lattice models. In such cases, increase the number of projection iterations.
Example:
model_config = tfl.configs.CalibratedLatticeConfig(
feature_configs=[
tfl.configs.FeatureConfig(
name='num_purchases',
dominates=[
configs.DominanceConfig(
feature_name='num_clicks', dominance_type='monotonic'),
],
),
tfl.configs.FeatureConfig(
name='num_clicks',
),
])
Args | |
---|---|
feature_name
|
Name of the "dominant" feature for the dominance
constraint.
|
dominance_type
|
Type of dominance constraint. Currently, supports
'monotonic' .
|
Methods
deserialize_nested_configs
@classmethod
deserialize_nested_configs( config, custom_objects=None )
Returns a deserialized configuration dictionary.
from_config
@classmethod
from_config( config, custom_objects=None )
get_config
get_config()
Returns a configuration dictionary.