Objects of this class are intended to be provided as the optimizer argument
(though LinearSDCA objects do not implement the tf.train.Optimizer
interface)
when creating tf.estimator.LinearClassifier or
tf.estimator.LinearRegressor.
SDCA can only be used with LinearClassifier and LinearRegressor under the
following conditions:
Feature columns are of type V2.
Multivalent categorical columns are not normalized. In other words the
sparse_combiner argument in the estimator constructor should be "sum".
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 sigma' in eq (11) of [3]. Convergence of (global)
loss is guaranteed if num_loss_partitions is larger or equal to the product
(#concurrent train ops/per worker) x (#workers). Larger values for
num_loss_partitions lead to slower convergence. The recommended value for
num_loss_partitions in tf.estimator (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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[],[],null,["# tf.estimator.experimental.LinearSDCA\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/canned/linear.py#L45-L238) |\n\nStochastic Dual Coordinate Ascent helper for linear estimators. (deprecated)\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n\\`tf.compat.v1.estimator.experimental.LinearSDCA\\`\n\n\u003cbr /\u003e\n\n tf.estimator.experimental.LinearSDCA(\n example_id_column,\n num_loss_partitions=1,\n num_table_shards=None,\n symmetric_l1_regularization=0.0,\n symmetric_l2_regularization=1.0,\n adaptive=False\n )\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.keras instead.\n\nObjects of this class are intended to be provided as the optimizer argument\n(though LinearSDCA objects do not implement the `tf.train.Optimizer`\ninterface)\nwhen creating [`tf.estimator.LinearClassifier`](../../../tf/estimator/LinearClassifier) or\n[`tf.estimator.LinearRegressor`](../../../tf/estimator/LinearRegressor).\n\nSDCA can only be used with `LinearClassifier` and `LinearRegressor` under the\nfollowing conditions:\n\n- Feature columns are of type V2.\n- Multivalent categorical columns are not normalized. In other words the `sparse_combiner` argument in the estimator constructor should be \"sum\".\n- For classification: binary label.\n- For regression: one-dimensional label.\n\n#### Example usage:\n\n real_feature_column = numeric_column(...)\n sparse_feature_column = categorical_column_with_hash_bucket(...)\n linear_sdca = tf.estimator.experimental.LinearSDCA(\n example_id_column='example_id',\n num_loss_partitions=1,\n num_table_shards=1,\n symmetric_l2_regularization=2.0)\n classifier = tf.estimator.LinearClassifier(\n feature_columns=[real_feature_column, sparse_feature_column],\n weight_column=...,\n optimizer=linear_sdca)\n classifier.train(input_fn_train, steps=50)\n classifier.evaluate(input_fn=input_fn_eval)\n\nHere the expectation is that the `input_fn_*` functions passed to train and\nevaluate return a pair (dict, label_tensor) where dict has `example_id_column`\nas `key` whose value is a `Tensor` of shape \\[batch_size\\] and dtype string.\nnum_loss_partitions defines sigma' in eq (11) of \\[3\\]. Convergence of (global)\nloss is guaranteed if `num_loss_partitions` is larger or equal to the product\n`(#concurrent train ops/per worker) x (#workers)`. Larger values for\n`num_loss_partitions` lead to slower convergence. The recommended value for\n`num_loss_partitions` in [`tf.estimator`](../../../tf/estimator) (where currently there is one process\nper worker) is the number of workers running the train steps. It defaults to 1\n(single machine).\n`num_table_shards` defines the number of shards for the internal state\ntable, typically set to match the number of parameter servers for large\ndata sets.\n\nThe SDCA algorithm was originally introduced in \\[1\\] and it was followed by\nthe L1 proximal step \\[2\\], a distributed version \\[3\\] and adaptive sampling \\[4\\].\n\\[1\\] www.jmlr.org/papers/volume14/shalev-shwartz13a/shalev-shwartz13a.pdf\n\\[2\\] \u003chttps://arxiv.org/pdf/1309.2375.pdf\u003e\n\\[3\\] \u003chttps://arxiv.org/pdf/1502.03508.pdf\u003e\n\\[4\\] \u003chttps://arxiv.org/pdf/1502.08053.pdf\u003e\nDetails specific to this implementation are provided in:\n\u003chttps://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/canned/linear_optimizer/doc/sdca.ipynb\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------------------|-------------------------------------------------------------------------------------------------------|\n| `example_id_column` | The column name containing the example ids. |\n| `num_loss_partitions` | Number of workers. |\n| `num_table_shards` | Number of shards of the internal state table, typically set to match the number of parameter servers. |\n| `symmetric_l1_regularization` | A float value, must be greater than or equal to zero. |\n| `symmetric_l2_regularization` | A float value, must be greater than zero and should typically be greater than 1. |\n| `adaptive` | A boolean indicating whether to use adaptive sampling. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `get_train_step`\n\n[View source](https://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/canned/linear.py#L176-L238) \n\n get_train_step(\n state_manager,\n weight_column_name,\n loss_type,\n feature_columns,\n features,\n targets,\n bias_var,\n global_step\n )\n\nReturns the training operation of an SdcaModel optimizer."]]