LostTech.TensorFlow : API Documentation

Type SVM

Namespace tensorflow.contrib.learn

Parent Estimator

Interfaces ISVM

Support Vector Machine (SVM) model for binary classification.

THIS CLASS IS DEPRECATED. See [contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md) for general migration instructions.

Currently, only linear SVMs are supported. For the underlying optimization problem, the `SDCAOptimizer` is used. For performance and convergence tuning, the num_loss_partitions parameter passed to `SDCAOptimizer` (see `__init__()` method), should be set to (#concurrent train ops per worker) x (#workers). If num_loss_partitions is larger or equal to this value, convergence is guaranteed but becomes slower as num_loss_partitions increases. If it is set to a smaller value, the optimizer is more aggressive in reducing the global loss but convergence is not guaranteed. The recommended value in an `Estimator` (where there is one process per worker) is the number of workers running the train steps. It defaults to 1 (single machine).

Example: Input of `fit` and `evaluate` should have following features, otherwise there will be a `KeyError`: a feature with `key=example_id_column` whose value is a `Tensor` of dtype string. if `weight_column_name` is not `None`, a feature with `key=weight_column_name` whose value is a `Tensor`. for each `column` in `feature_columns`: - if `column` is a `SparseColumn`, a feature with `key=column.name` whose `value` is a `SparseTensor`. - if `column` is a `RealValuedColumn, a feature with `key=column.name` whose `value` is a `Tensor`.
Show Example
real_feature_column = real_valued_column(...)
            sparse_feature_column = sparse_column_with_hash_bucket(...) 

estimator = SVM( example_id_column='example_id', feature_columns=[real_feature_column, sparse_feature_column], l2_regularization=10.0)

# Input builders def input_fn_train: # returns x, y ... def input_fn_eval: # returns x, y ...

estimator.fit(input_fn=input_fn_train) estimator.evaluate(input_fn=input_fn_eval) estimator.predict(x=x)

Methods

Properties

Public instance methods

object export(Byte[] export_dir, PythonFunctionContainer signature_fn, PythonFunctionContainer input_fn, bool default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export(Byte[] export_dir, PythonFunctionContainer signature_fn, PythonFunctionContainer input_fn, int default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export(Byte[] export_dir, PythonFunctionContainer signature_fn, string input_fn, bool default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export(Byte[] export_dir, PythonFunctionContainer signature_fn, string input_fn, int default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export(string export_dir, PythonFunctionContainer signature_fn, PythonFunctionContainer input_fn, bool default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export(string export_dir, PythonFunctionContainer signature_fn, PythonFunctionContainer input_fn, int default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export(string export_dir, PythonFunctionContainer signature_fn, string input_fn, bool default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export(string export_dir, PythonFunctionContainer signature_fn, string input_fn, int default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export_dyn(object export_dir, object signature_fn, object input_fn, ImplicitContainer<T> default_batch_size, object exports_to_keep)

See BaseEstimator.export. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export_with_defaults(object export_dir, PythonFunctionContainer signature_fn, PythonFunctionContainer input_fn, int default_batch_size, object exports_to_keep)

Same as BaseEstimator.export, but uses some defaults. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

object export_with_defaults_dyn(object export_dir, object signature_fn, object input_fn, ImplicitContainer<T> default_batch_size, object exports_to_keep)

Same as BaseEstimator.export, but uses some defaults. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-25. Instructions for updating: Please use Estimator.export_savedmodel() instead.

IEnumerator<object> predict_proba(object x, PythonFunctionContainer input_fn, object batch_size, object outputs, bool as_iterable)

Runs inference to determine the class probability predictions. (deprecated argument values)

Warning: SOME ARGUMENT VALUES ARE DEPRECATED: `(as_iterable=False)`. They will be removed after 2016-09-15. Instructions for updating: The default behavior of predict() is changing. The default value for as_iterable will change to True, and then the flag will be removed altogether. The behavior of this flag is described below.

object predict_proba_dyn(object x, object input_fn, object batch_size, object outputs, ImplicitContainer<T> as_iterable)

Runs inference to determine the class probability predictions. (deprecated argument values)

Warning: SOME ARGUMENT VALUES ARE DEPRECATED: `(as_iterable=False)`. They will be removed after 2016-09-15. Instructions for updating: The default behavior of predict() is changing. The default value for as_iterable will change to True, and then the flag will be removed altogether. The behavior of this flag is described below.

Public static methods

SVM NewDyn(object example_id_column, object feature_columns, object weight_column_name, object model_dir, ImplicitContainer<T> l1_regularization, ImplicitContainer<T> l2_regularization, ImplicitContainer<T> num_loss_partitions, object kernels, object config, object feature_engineering_fn)

Constructs an `SVM` estimator object.
Parameters
object example_id_column
A string defining the feature column name representing example ids. Used to initialize the underlying optimizer.
object 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`.
object 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.
object 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.
ImplicitContainer<T> l1_regularization
L1-regularization parameter. Refers to global L1 regularization (across all examples).
ImplicitContainer<T> l2_regularization
L2-regularization parameter. Refers to global L2 regularization (across all examples).
ImplicitContainer<T> num_loss_partitions
number of partitions of the (global) loss function optimized by the underlying optimizer (SDCAOptimizer).
object kernels
A list of kernels for the SVM. Currently, no kernels are supported. Reserved for future use for non-linear SVMs.
object config
RunConfig object to configure the runtime settings.
object feature_engineering_fn
Feature engineering function. Takes features and labels which are the output of `input_fn` and returns features and labels which will be fed into the model.

Public properties

object config get;

object config_dyn get;

string model_dir get;

object model_dir_dyn get;

object model_fn get;

object model_fn_dyn get;

object PythonObject get;