tfl.pwl_calibration_layer.LaplacianRegularizer
Stay organized with collections
Save and categorize content based on your preferences.
Laplacian regularizer for PWL calibration layer.
tfl.pwl_calibration_layer.LaplacianRegularizer(
l1=0.0, l2=0.0, is_cyclic=False
)
Calibrator Laplacian regularization penalizes the change in the calibration
output. It is defined to be:
l1 * ||delta||_1 + l2 * ||delta||_2^2
where delta
is:
output_keypoints[1:end] - output_keypoints[0:end-1]
.
Args |
l1
|
l1 regularization amount as float.
|
l2
|
l2 regularization amount as float.
|
is_cyclic
|
Whether the first and last keypoints should take the same
output value.
|
Methods
from_config
@classmethod
from_config(
config
)
Creates a regularizer from its config.
This method is the reverse of get_config
,
capable of instantiating the same regularizer from the config
dictionary.
This method is used by TF-Keras model_to_estimator
, saving and
loading models to HDF5 formats, TF-Keras model cloning, some
visualization utilities, and exporting models to and from JSON.
Args |
config
|
A Python dictionary, typically the output of get_config.
|
Returns |
A regularizer instance.
|
get_config
View source
get_config()
Standard Keras config for serialization.
__call__
View source
__call__(
x
)
Returns regularization loss.
Args |
x
|
Tensor of shape: (k, units) which represents weights of PWL
calibration layer. First row of weights is bias term. All remaining
represent delta in y-value compare to previous point (segment heights).
|
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-02 UTC."],[],[],null,["# tfl.pwl_calibration_layer.LaplacianRegularizer\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/pwl_calibration_layer.py#L815-L879) |\n\nLaplacian regularizer for PWL calibration layer. \n\n tfl.pwl_calibration_layer.LaplacianRegularizer(\n l1=0.0, l2=0.0, is_cyclic=False\n )\n\nCalibrator Laplacian regularization penalizes the change in the calibration\noutput. It is defined to be:\n\n`l1 * ||delta||_1 + l2 * ||delta||_2^2`\n\nwhere `delta` is:\n\n`output_keypoints[1:end] - output_keypoints[0:end-1]`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|-------------------------------------------------------------------------|\n| `l1` | l1 regularization amount as float. |\n| `l2` | l2 regularization amount as float. |\n| `is_cyclic` | Whether the first and last keypoints should take the same output value. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `from_config`\n\n @classmethod\n from_config(\n config\n )\n\nCreates a regularizer from its config.\n\nThis method is the reverse of `get_config`,\ncapable of instantiating the same regularizer from the config\ndictionary.\n\nThis method is used by TF-Keras `model_to_estimator`, saving and\nloading models to HDF5 formats, TF-Keras model cloning, some\nvisualization utilities, and exporting models to and from JSON.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------|----------------------------------------------------------|\n| `config` | A Python dictionary, typically the output of get_config. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A regularizer instance. ||\n\n\u003cbr /\u003e\n\n### `get_config`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/pwl_calibration_layer.py#L873-L879) \n\n get_config()\n\nStandard Keras config for serialization.\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/pwl_calibration_layer.py#L845-L871) \n\n __call__(\n x\n )\n\nReturns regularization loss.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `x` | Tensor of shape: `(k, units)` which represents weights of PWL calibration layer. First row of weights is bias term. All remaining represent delta in y-value compare to previous point (segment heights). |\n\n\u003cbr /\u003e"]]