LpNormNormalizingEstimator Class

Definition

Normalizes (scales) vectors in the input column to the unit norm. The type of norm that is used can be specified by the user.

public sealed class LpNormNormalizingEstimator : Microsoft.ML.Transforms.LpNormNormalizingEstimatorBase
type LpNormNormalizingEstimator = class
    inherit LpNormNormalizingEstimatorBase
Public NotInheritable Class LpNormNormalizingEstimator
Inherits LpNormNormalizingEstimatorBase
Inheritance

Remarks

Estimator Characteristics

Does this estimator need to look at the data to train its parameters? No
Input column data type Vector of Single
Output column data type Vector of Single
Exportable to ONNX Yes

The resulting LpNormNormalizingTransformer normalizes vectors in the input column individually by rescaling them to the unit norm.

Let $x$ be the input vector, $n$ the size of the vector, $L(x)$ the norm function selected by the user. Let $\mu(x) = \sum_i x_i / n$ be the mean of the values of vector $x$. The LpNormNormalizingTransformer performs the following operation on each input vector $x$: $y = \frac{x - \mu(x)}{L(x)}$ if the user specifies that the mean should be zero, or otherwise: $y = \frac{x}{L(x)}$

There are four types of norm that can be selected by the user to be applied on input vector $x$. They are defined as follows:

  • L1: $L_1(x) = \sum_i |x_i|$
  • L2: $L_2(x) = \sqrt{\sum_i x_i^2}$
  • Infinity: $L_{\infty}(x) = \max_i{|x_i|}$
  • StandardDeviation: $L_\sigma(x)$ is defined as the standard deviation of the elements of the input vector $x$

Check the See Also section for links to usage examples.

Methods

Fit(IDataView) (Inherited from TrivialEstimator<TTransformer>)
GetOutputSchema(SchemaShape)

Returns the SchemaShape of the schema which will be produced by the transformer. Used for schema propagation and verification in a pipeline.

(Inherited from LpNormNormalizingEstimatorBase)

Extension Methods

AppendCacheCheckpoint<TTrans>(IEstimator<TTrans>, IHostEnvironment)

Append a 'caching checkpoint' to the estimator chain. This will ensure that the downstream estimators will be trained against cached data. It is helpful to have a caching checkpoint before trainers that take multiple data passes.

WithOnFitDelegate<TTransformer>(IEstimator<TTransformer>, Action<TTransformer>)

Given an estimator, return a wrapping object that will call a delegate once Fit(IDataView) is called. It is often important for an estimator to return information about what was fit, which is why the Fit(IDataView) method returns a specifically typed object, rather than just a general ITransformer. However, at the same time, IEstimator<TTransformer> are often formed into pipelines with many objects, so we may need to build a chain of estimators via EstimatorChain<TLastTransformer> where the estimator for which we want to get the transformer is buried somewhere in this chain. For that scenario, we can through this method attach a delegate that will be called once fit is called.

Applies to

See also