tfl.configs.DominanceConfig
Stay organized with collections
Save and categorize content based on your preferences.
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
View source
@classmethod
deserialize_nested_configs(
config, custom_objects=None
)
Returns a deserialized configuration dictionary.
from_config
View source
@classmethod
from_config(
config, custom_objects=None
)
get_config
View source
get_config()
Returns a configuration dictionary.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-02 UTC.
[null,null,["Last updated 2024-08-02 UTC."],[],[],null,["# tfl.configs.DominanceConfig\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/configs.py#L1051-L1099) |\n\nConfiguration for dominance constraints in TFL canned estimators. \n\n tfl.configs.DominanceConfig(\n feature_name, dominance_type='monotonic'\n )\n\nYou can specify how a feature dominantes another feature. Supported dominance\ntypes (see [`tfl.layers.Lattice`](../../tfl/layers/Lattice) and [`tfl.layers.Linear`](../../tfl/layers/Linear) for details):\n\n- `'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.\n\n#### Example:\n\n model_config = tfl.configs.CalibratedLatticeConfig(\n feature_configs=[\n tfl.configs.FeatureConfig(\n name='num_purchases',\n dominates=[\n configs.DominanceConfig(\n feature_name='num_clicks', dominance_type='monotonic'),\n ],\n ),\n tfl.configs.FeatureConfig(\n name='num_clicks',\n ),\n ])\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|------------------------------------------------------------------|\n| `feature_name` | Name of the `\"dominant\"` feature for the dominance constraint. |\n| `dominance_type` | Type of dominance constraint. Currently, supports `'monotonic'`. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `deserialize_nested_configs`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/configs.py#L124-L158) \n\n @classmethod\n deserialize_nested_configs(\n config, custom_objects=None\n )\n\nReturns a deserialized configuration dictionary.\n\n### `from_config`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/configs.py#L1096-L1099) \n\n @classmethod\n from_config(\n config, custom_objects=None\n )\n\n### `get_config`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/configs.py#L93-L122) \n\n get_config()\n\nReturns a configuration dictionary."]]