Example #1
0
def create_calibrated_lattice(feature_columns, config, quantiles_dir):
    feature_names = [fc.name for fc in feature_columns]
    hparams = tfl.CalibratedLatticeHParams(feature_names=feature_names,
                                           num_keypoints=200,
                                           lattice_l2_laplacian_reg=5e-4,
                                           lattice_l2_torsion_reg=1e-4,
                                           learning_rate=lr,
                                           lattice_size=2)
    hparams.set_feature_param("feature1", "monotonicity", 1)
    return tfl.calibrated_lattice_classifier(feature_columns=feature_columns,
                                             model_dir=config.model_dir,
                                             config=config,
                                             hparams=hparams,
                                             quantiles_dir=quantiles_dir)
Example #2
0
def create_calibrated_lattice(feature_columns, config, quantiles_dir):
    """Creates a calibrated lattice estimator."""
    feature_names = [fc.name for fc in feature_columns]
    hparams = tfl.CalibratedLatticeHParams(feature_names=feature_names,
                                           num_keypoints=200,
                                           lattice_l2_laplacian_reg=5.0e-3,
                                           lattice_l2_torsion_reg=1.0e-4,
                                           learning_rate=0.1,
                                           lattice_size=2)
    hparams.parse(FLAGS.hparams)
    _pprint_hparams(hparams)
    return tfl.calibrated_lattice_classifier(feature_columns=feature_columns,
                                             model_dir=config.model_dir,
                                             config=config,
                                             hparams=hparams,
                                             quantiles_dir=quantiles_dir)