View source on GitHub |
Config for calibrated lattice model.
tfl.configs.CalibratedLinearConfig( feature_configs=None, regularizer_configs=None, use_bias=True, output_min=None, output_max=None, output_calibration=False, output_calibration_num_keypoints=10, output_initialization='quantiles', output_calibration_input_keypoints_type='fixed' ) Used in the notebooks
| Used in the tutorials |
|---|
A calibrated linear model applies piecewise-linear and categorical calibration on the input feature, followed by a linear combination and an optional output piecewise-linear calibration. When using output calibration or when output bounds are specified, the linear layer will be apply weighted averaging on calibrated inputs.
Example:
model_config = tfl.configs.CalibratedLinearConfig( feature_configs=[...], ) feature_analysis_input_fn = create_input_fn(num_epochs=1, ...) train_input_fn = create_input_fn(num_epochs=100, ...) estimator = tfl.estimators.CannedClassifier( feature_columns=feature_columns, model_config=model_config, feature_analysis_input_fn=feature_analysis_input_fn) estimator.train(input_fn=train_input_fn) Args | |
|---|---|
feature_configs | A list of tfl.configs.FeatureConfig instances that specify configurations for each feature. If a configuration is not provided for a feature, a default configuration will be used. |
regularizer_configs | A list of tfl.configs.RegularizerConfig instances that apply global regularization. |
use_bias | If a bias term should be used for the linear combination. |
output_min | Lower bound constraint on the output of the model. |
output_max | Upper bound constraint on the output of the model. |
output_calibration | If a piecewise-linear calibration should be used on the output of the lattice. |
output_calibration_num_keypoints | Number of keypoints to use for the output piecewise-linear calibration. |
output_initialization | The initial values to setup for the output of the model. When using output calibration, these values are used to initialize the output keypoints of the output piecewise-linear calibration. Otherwise the lattice parameters will be setup to form a linear function in the range of output_initialization. It can be one of:
|
output_calibration_input_keypoints_type | One of "fixed" or "learned_interior". If "learned_interior", keypoints are initialized to the values in pwl_calibration_input_keypoints but then allowed to vary during training, with the exception of the first and last keypoint location which are fixed. |
Methods
deserialize_nested_configs
@classmethoddeserialize_nested_configs( config, custom_objects=None )
Returns a deserialized configuration dictionary.
feature_config_by_name
feature_config_by_name( feature_name ) Returns existing or default FeatureConfig with the given name.
from_config
@classmethodfrom_config( config, custom_objects=None )
get_config
get_config() Returns a configuration dictionary.
regularizer_config_by_name
regularizer_config_by_name( regularizer_name ) Returns existing or default RegularizerConfig with the given name.
View source on GitHub