tf.contrib.learn.LinearClassifier.__init__()

tf.contrib.learn.LinearClassifier.__init__(feature_columns, model_dir=None, n_classes=2, weight_column_name=None, optimizer=None, gradient_clip_norm=None, enable_centered_bias=None, _joint_weight=False, config=None)

Construct a LinearClassifier estimator object.

Args:
  • feature_columns: An iterable containing all the feature columns used by the model. All items in the set should be instances of classes derived from FeatureColumn.
  • model_dir: Directory to save model parameters, graph and etc. This can also be used to load checkpoints from the directory into a estimator to continue training a previously saved model.
  • n_classes: number of target classes. Default is binary classification.
  • weight_column_name: A string defining feature column name representing weights. It is used to down weight or boost examples during training. It will be multiplied by the loss of the example.
  • optimizer: The optimizer used to train the model. If specified, it should be either an instance of tf.Optimizer or the SDCAOptimizer. If None, the Ftrl optimizer will be used.
  • gradient_clip_norm: A float > 0. If provided, gradients are clipped to their global norm with this clipping ratio. See tf.clip_by_global_norm for more details.
  • enable_centered_bias: A bool. If True, estimator will learn a centered bias variable for each class. Rest of the model structure learns the residual after centered bias. _joint_weight: If True, the weights for all columns will be stored in a single (possibly partitioned) variable. It's more efficient, but it's incompatible with SDCAOptimizer, and requires all feature columns are sparse and use the 'sum' combiner.

  • config: RunConfig object to configure the runtime settings.

Returns:

A LinearClassifier estimator.

Raises:
  • ValueError: if n_classes < 2.
doc_TensorFlow
2016-10-14 13:05:51
Comments
Leave a Comment

Please login to continue.