tft.scale_to_gaussian
Stay organized with collections
Save and categorize content based on your preferences.
Returns an (approximately) normal column with mean to 0 and variance 1.
tft.scale_to_gaussian(
x: common_types.ConsistentTensorType,
elementwise: bool = False,
name: Optional[str] = None,
output_dtype: Optional[tf.DType] = None
) -> common_types.ConsistentTensorType
We transform the column to values that are approximately distributed
according to a standard normal distribution.
The transformation is obtained by applying the moments method to estimate
the parameters of a Tukey HH distribution and applying the inverse of the
estimated function to the column values.
The method is partially described in
Georg M. Georgm "The Lambert Way to Gaussianize Heavy-Tailed Data with the
Inverse of Tukey's h Transformation as a Special Case," The Scientific World
Journal, Vol. 2015, Hindawi Publishing Corporation.
We use the L-moments instead of conventional moments to be able to deal with
long-tailed distributions. The expressions of the L-moments for the Tukey HH
distribution is in
Todd C. Headrick, and Mohan D. Pant. "Characterizing Tukey H and
HH-Distributions through L-Moments and the L-Correlation," ISRN Applied
Mathematics, vol. 2012, 2012. doi:10.5402/2012/980153
Note that the transformation to Gaussian is applied only if the column has
long-tails. If this is not the case, for instance if values are uniformly
distributed, the values are only normalized using the z score. This applies
also to the cases where only one of the tails is long; the other tail is only
rescaled but not non linearly transformed.
Also, if the analysis set is empty, the transformation is set to to leave the
input vaules unchanged.
Args |
x
|
A numeric Tensor , SparseTensor , or RaggedTensor .
|
elementwise
|
If true, scales each element of the tensor independently;
otherwise uses the parameters of the whole tensor.
|
name
|
(Optional) A name for this operation.
|
output_dtype
|
(Optional) If not None, casts the output tensor to this type.
|
Returns |
A Tensor , SparseTensor , or RaggedTensor containing the input column
transformed to be approximately standard distributed (i.e. a Gaussian with
mean 0 and variance 1). If x is floating point, the mean will have the
same type as x . If x is integral, the output is cast to tf.float32.
Note that TFLearn generally permits only tf.int64 and tf.float32, so casting
this scaler's output may be necessary.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-01 UTC.
[[["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 2024-11-01 UTC."],[],[],null,["# tft.scale_to_gaussian\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/transform/blob/v1.16.0/tensorflow_transform/mappers.py#L70-L126) |\n\nReturns an (approximately) normal column with mean to 0 and variance 1. \n\n tft.scale_to_gaussian(\n x: common_types.ConsistentTensorType,\n elementwise: bool = False,\n name: Optional[str] = None,\n output_dtype: Optional[tf.DType] = None\n ) -\u003e common_types.ConsistentTensorType\n\nWe transform the column to values that are approximately distributed\naccording to a standard normal distribution.\nThe transformation is obtained by applying the moments method to estimate\nthe parameters of a Tukey HH distribution and applying the inverse of the\nestimated function to the column values.\nThe method is partially described in\n\nGeorg M. Georgm \"The Lambert Way to Gaussianize Heavy-Tailed Data with the\nInverse of Tukey's h Transformation as a Special Case,\" The Scientific World\nJournal, Vol. 2015, Hindawi Publishing Corporation.\n\nWe use the L-moments instead of conventional moments to be able to deal with\nlong-tailed distributions. The expressions of the L-moments for the Tukey HH\ndistribution is in\n\nTodd C. Headrick, and Mohan D. Pant. \"Characterizing Tukey H and\nHH-Distributions through L-Moments and the L-Correlation,\" ISRN Applied\nMathematics, vol. 2012, 2012. doi:10.5402/2012/980153\n\nNote that the transformation to Gaussian is applied only if the column has\nlong-tails. If this is not the case, for instance if values are uniformly\ndistributed, the values are only normalized using the z score. This applies\nalso to the cases where only one of the tails is long; the other tail is only\nrescaled but not non linearly transformed.\nAlso, if the analysis set is empty, the transformation is set to to leave the\ninput vaules unchanged.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------|--------------------------------------------------------------------------------------------------------------|\n| `x` | A numeric `Tensor`, `SparseTensor`, or `RaggedTensor`. |\n| `elementwise` | If true, scales each element of the tensor independently; otherwise uses the parameters of the whole tensor. |\n| `name` | (Optional) A name for this operation. |\n| `output_dtype` | (Optional) If not None, casts the output tensor to this type. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor`, `SparseTensor`, or `RaggedTensor` containing the input column transformed to be approximately standard distributed (i.e. a Gaussian with mean 0 and variance 1). If `x` is floating point, the mean will have the same type as `x`. If `x` is integral, the output is cast to tf.float32. \u003cbr /\u003e Note that TFLearn generally permits only tf.int64 and tf.float32, so casting this scaler's output may be necessary. ||\n\n\u003cbr /\u003e"]]