LostTech.TensorFlow : API Documentation

Type SDCAOptimizer

Namespace tensorflow.contrib.linear_optimizer

Parent PythonObjectContainer

Interfaces ISDCAOptimizer

Wrapper class for SDCA optimizer.

The wrapper is currently meant for use as an optimizer within a tf.learn Estimator.

Example usage: Here the expectation is that the `input_fn_*` functions passed to train and evaluate return a pair (dict, label_tensor) where dict has `example_id_column` as `key` whose value is a `Tensor` of shape [batch_size] and dtype string. num_loss_partitions defines the number of partitions of the global loss function and should be set to `(#concurrent train ops/per worker) x (#workers)`. Convergence of (global) loss is guaranteed if `num_loss_partitions` is larger or equal to the above product. Larger values for `num_loss_partitions` lead to slower convergence. The recommended value for `num_loss_partitions` in `tf.learn` (where currently there is one process per worker) is the number of workers running the train steps. It defaults to 1 (single machine). `num_table_shards` defines the number of shards for the internal state table, typically set to match the number of parameter servers for large data sets. You can also specify a `partitioner` object to partition the primal weights during training (`div` partitioning strategy will be used).
Show Example
real_feature_column = real_valued_column(...)
            sparse_feature_column = sparse_column_with_hash_bucket(...)
            sdca_optimizer = linear.SDCAOptimizer(example_id_column='example_id',
                                                  num_loss_partitions=1,
                                                  num_table_shards=1,
                                                  symmetric_l2_regularization=2.0)
            classifier = tf.contrib.learn.LinearClassifier(
                feature_columns=[real_feature_column, sparse_feature_column],
                weight_column_name=...,
                optimizer=sdca_optimizer)
            classifier.fit(input_fn_train, steps=50)
            classifier.evaluate(input_fn=input_fn_eval) 

Methods

Properties

Public instance methods

ValueTuple<SdcaModel, object> get_train_step(IDictionary<object, object> columns_to_variables, object weight_column_name, string loss_type, object features, object targets, IGraphNodeBase global_step)

Returns the training operation of an SdcaModel optimizer.

object get_train_step_dyn(object columns_to_variables, object weight_column_name, object loss_type, object features, object targets, object global_step)

Returns the training operation of an SdcaModel optimizer.

Public static methods

SDCAOptimizer NewDyn(object example_id_column, ImplicitContainer<T> num_loss_partitions, object num_table_shards, ImplicitContainer<T> symmetric_l1_regularization, ImplicitContainer<T> symmetric_l2_regularization, ImplicitContainer<T> adaptive, object partitioner)

Initialize self. See help(type(self)) for accurate signature.

Public properties

bool adaptive get;

object adaptive_dyn get;

object example_id_column get;

object example_id_column_dyn get;

int num_loss_partitions get;

object num_loss_partitions_dyn get;

object num_table_shards get;

object num_table_shards_dyn get;

object partitioner get;

object partitioner_dyn get;

object PythonObject get;

double symmetric_l1_regularization get;

object symmetric_l1_regularization_dyn get;

double symmetric_l2_regularization get;

object symmetric_l2_regularization_dyn get;