tfl.configs.CalibratedLatticeConfig

Config for calibrated lattice model.

Used in the notebooks

Used in the tutorials

A calibrated lattice model applies piecewise-linear and categorical calibration on the input feature, followed by a lattice model and an optional output piecewise-linear calibration.

Example:

model_config = tfl.configs.CalibratedLatticeConfig(
    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)

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.
interpolation One of 'hypercube' or 'simplex' interpolation. For a d-dimensional lattice, 'hypercube' interpolates 2^d parameters, whereas 'simplex' uses d+1 parameters and thus scales better. For details see tfl.lattice_lib.evaluate_with_simplex_interpolation and tfl.lattice_lib.evaluate_with_hypercube_interpolation.
regularizer_configs A list of tfl.configs.RegularizerConfig instances that apply global regularization.
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:

  • String 'quantiles': Output is initliazed to label quantiles, if possible.
  • String 'uniform': Output is initliazed uniformly in label range.
  • A list of numbers: To be used for initialization of the output lattice or output calibrator.

Methods

deserialize_nested_configs

View source

Returns a deserialized configuration dictionary.

feature_config_by_name

View source

Returns existing or default FeatureConfig with the given name.

from_config

View source

get_config

View source

Returns a configuration dictionary.

regularizer_config_by_name

View source

Returns existing or default RegularizerConfig with the given name.