LostTech.TensorFlow : API Documentation

Type KMeansClustering

Namespace tensorflow.contrib.learn

Parent Estimator

Interfaces IKMeansClustering

An Estimator for K-Means clustering.

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

Methods

Properties

Fields

Public instance methods

object clusters_dyn()

Returns the clusters with dimensions num_classes X 1 X num_dimensions.

IEnumerator<object> predict_cluster_idx(PythonFunctionContainer input_fn)

Yields predicted cluster indices. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use tf.contrib.factorization.KMeansClustering instead of tf.contrib.learn.KMeansClustering. It has a similar interface, but uses the tf.estimator.Estimator API instead of tf.contrib.learn.Estimator.

object predict_cluster_idx_dyn(object input_fn)

Yields predicted cluster indices. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use tf.contrib.factorization.KMeansClustering instead of tf.contrib.learn.KMeansClustering. It has a similar interface, but uses the tf.estimator.Estimator API instead of tf.contrib.learn.Estimator.

object score(PythonFunctionContainer input_fn, int steps)

Predict total sum of distances to nearest clusters. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use tf.contrib.factorization.KMeansClustering instead of tf.contrib.learn.KMeansClustering. It has a similar interface, but uses the tf.estimator.Estimator API instead of tf.contrib.learn.Estimator.

Note that this function is different from the corresponding one in sklearn which returns the negative of the sum of distances.
Parameters
PythonFunctionContainer input_fn
see predict.
int steps
see predict.
Returns
object
Total sum of distances to nearest clusters.

object score(PythonFunctionContainer input_fn, object steps)

Predict total sum of distances to nearest clusters. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use tf.contrib.factorization.KMeansClustering instead of tf.contrib.learn.KMeansClustering. It has a similar interface, but uses the tf.estimator.Estimator API instead of tf.contrib.learn.Estimator.

Note that this function is different from the corresponding one in sklearn which returns the negative of the sum of distances.
Parameters
PythonFunctionContainer input_fn
see predict.
object steps
see predict.
Returns
object
Total sum of distances to nearest clusters.

object score_dyn(object input_fn, object steps)

Predict total sum of distances to nearest clusters. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use tf.contrib.factorization.KMeansClustering instead of tf.contrib.learn.KMeansClustering. It has a similar interface, but uses the tf.estimator.Estimator API instead of tf.contrib.learn.Estimator.

Note that this function is different from the corresponding one in sklearn which returns the negative of the sum of distances.
Parameters
object input_fn
see predict.
object steps
see predict.
Returns
object
Total sum of distances to nearest clusters.

object transform(PythonFunctionContainer input_fn, bool as_iterable)

Transforms each element to distances to cluster centers. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use tf.contrib.factorization.KMeansClustering instead of tf.contrib.learn.KMeansClustering. It has a similar interface, but uses the tf.estimator.Estimator API instead of tf.contrib.learn.Estimator.

Note that this function is different from the corresponding one in sklearn. For SQUARED_EUCLIDEAN distance metric, sklearn transform returns the EUCLIDEAN distance, while this function returns the SQUARED_EUCLIDEAN distance.
Parameters
PythonFunctionContainer input_fn
see predict.
bool as_iterable
see predict
Returns
object
Array with same number of rows as x, and num_clusters columns, containing distances to the cluster centers.

object transform_dyn(object input_fn, ImplicitContainer<T> as_iterable)

Transforms each element to distances to cluster centers. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use tf.contrib.factorization.KMeansClustering instead of tf.contrib.learn.KMeansClustering. It has a similar interface, but uses the tf.estimator.Estimator API instead of tf.contrib.learn.Estimator.

Note that this function is different from the corresponding one in sklearn. For SQUARED_EUCLIDEAN distance metric, sklearn transform returns the EUCLIDEAN distance, while this function returns the SQUARED_EUCLIDEAN distance.
Parameters
object input_fn
see predict.
ImplicitContainer<T> as_iterable
see predict
Returns
object
Array with same number of rows as x, and num_clusters columns, containing distances to the cluster centers.

Public static methods

KMeansClustering NewDyn(object num_clusters, object model_dir, ImplicitContainer<T> initial_clusters, ImplicitContainer<T> distance_metric, ImplicitContainer<T> random_seed, ImplicitContainer<T> use_mini_batch, ImplicitContainer<T> mini_batch_steps_per_iteration, ImplicitContainer<T> kmeans_plus_plus_num_retries, object relative_tolerance, object config)

Creates a model for running KMeans training and inference. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use tf.contrib.factorization.KMeansClustering instead of tf.contrib.learn.KMeansClustering. It has a similar interface, but uses the tf.estimator.Estimator API instead of tf.contrib.learn.Estimator.
Parameters
object num_clusters
number of clusters to train.
object model_dir
the directory to save the model results and log files.
ImplicitContainer<T> initial_clusters
specifies how to initialize the clusters for training. See clustering_ops.kmeans for the possible values.
ImplicitContainer<T> distance_metric
the distance metric used for clustering. See clustering_ops.kmeans for the possible values.
ImplicitContainer<T> random_seed
Python integer. Seed for PRNG used to initialize centers.
ImplicitContainer<T> use_mini_batch
If true, use the mini-batch k-means algorithm. Else assume full batch.
ImplicitContainer<T> mini_batch_steps_per_iteration
number of steps after which the updated cluster centers are synced back to a master copy. See clustering_ops.py for more details.
ImplicitContainer<T> kmeans_plus_plus_num_retries
For each point that is sampled during kmeans++ initialization, this parameter specifies the number of additional points to draw from the current distribution before selecting the best. If a negative value is specified, a heuristic is used to sample O(log(num_to_sample)) additional points.
object relative_tolerance
A relative tolerance of change in the loss between iterations. Stops learning if the loss changes less than this amount. Note that this may not work correctly if use_mini_batch=True.
object config
See Estimator

Public properties

object ALL_SCORES_dyn get; set;

object CLUSTER_IDX_dyn get; set;

object CLUSTERS_dyn get; set;

object config get;

object config_dyn get;

object COSINE_DISTANCE_dyn get; set;

object KMEANS_PLUS_PLUS_INIT_dyn get; set;

object LOSS_OP_NAME_dyn get; set;

string model_dir get;

object model_dir_dyn get;

object model_fn get;

object model_fn_dyn get;

object PythonObject get;

object RANDOM_INIT_dyn get; set;

object SCORES_dyn get; set;

object SQUARED_EUCLIDEAN_DISTANCE_dyn get; set;

Public fields

string SCORES

return string

string CLUSTER_IDX

return string

string CLUSTERS

return string

string ALL_SCORES

return string

string LOSS_OP_NAME

return string