Module: tfl.configs

TFL model configuration library for canned estimators.

To construct a TFL canned estimator, construct a model configuration and pass it to the canned estimator constructor:

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

Supported models are:

  • Calibrated linear model: Constructed using tfl.configs.CalibratedLinearConfig. A calibrated linear model that 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 apply weighted averaging on calibrated inputs.

  • Calibrated lattice model: Constructed using tfl.configs.CalibratedLatticeConfig. 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.

  • Calibrated lattice ensemble model: Constructed using tfl.configs.CalibratedLatticeEnsembleConfig. A calibrated lattice ensemble model applies piecewise-linear and categorical calibration on the input feature, followed by an ensemble of lattice models and an optional output piecewise-linear calibration.

Feature calibration and per-feature configurations are set using tfl.configs.FeatureConfig. Feature configurations include monotonicity constraints, per-feature regularization (see tfl.configs.RegularizerConfig), and lattice sizes for lattice models.

Classes

class AggregateFunctionConfig: Config for aggregate function learning model.

class CalibratedLatticeConfig: Config for calibrated lattice model.

class CalibratedLatticeEnsembleConfig: Config for calibrated lattice model.

class CalibratedLinearConfig: Config for calibrated lattice model.

class DominanceConfig: Configuration for dominance constraints in TFL canned estimators.

class FeatureConfig: Per-feature configuration for TFL canned estimators.

class RegularizerConfig: Regularizer configuration for TFL canned estimators.

class TrustConfig: Configuration for feature trusts in TFL canned estimators.

Functions

apply_updates(...): Updates a model config with the given set of (key, values) updates.

absolute_import Instance of __future__._Feature
division Instance of __future__._Feature
print_function Instance of __future__._Feature