Esempio n. 1
0
 /// <summary>
 /// Takes column filled with a vector of random variables with a known covariance matrix into a set of new variables whose covariance is the identity matrix,
 /// meaning that they are uncorrelated and each have variance 1.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="inputColumn">Name of the input column.</param>
 /// <param name="outputColumn">Name of the column resulting from the transformation of <paramref name="inputColumn"/>.
 /// Null means <paramref name="inputColumn"/> is replaced. </param>
 /// <param name="kind">Whitening kind (PCA/ZCA).</param>
 /// <param name="eps">Whitening constant, prevents division by zero.</param>
 /// <param name="maxRows">Maximum number of rows used to train the transform.</param>
 /// <param name="pcaNum">In case of PCA whitening, indicates the number of components to retain.</param>
 /// <example>
 /// <format type="text/markdown">
 /// <![CDATA[
 /// [!code-csharp[VectorWhiten](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ProjectionTransforms.cs?range=1-6,12-112)]
 /// ]]>
 /// </format>
 /// </example>
 public static VectorWhiteningEstimator VectorWhiten(this TransformsCatalog.ProjectionTransforms catalog,
                                                     string inputColumn, string outputColumn = null,
                                                     WhiteningKind kind = VectorWhiteningTransformer.Defaults.Kind,
                                                     float eps          = VectorWhiteningTransformer.Defaults.Eps,
                                                     int maxRows        = VectorWhiteningTransformer.Defaults.MaxRows,
                                                     int pcaNum         = VectorWhiteningTransformer.Defaults.PcaNum)
 => new VectorWhiteningEstimator(CatalogUtils.GetEnvironment(catalog), inputColumn, outputColumn, kind, eps, maxRows, pcaNum);
 /// <summary>
 /// Takes columns filled with a vector of random variables with a known covariance matrix into a set of new variables whose covariance is the identity matrix,
 /// meaning that they are uncorrelated and each have variance 1.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="columns">Describes the parameters of the whitening process for each column pair.</param>
 public static VectorWhiteningEstimator VectorWhiten(this TransformsCatalog.ProjectionTransforms catalog, params VectorWhiteningTransformer.ColumnInfo[] columns)
 => new VectorWhiteningEstimator(CatalogUtils.GetEnvironment(catalog), columns);
Esempio n. 3
0
 /// <summary>Initializes a new instance of <see cref="PrincipalComponentAnalysisEstimator"/>.</summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="columns">Input columns to apply PrincipalComponentAnalysis on.</param>
 public static PrincipalComponentAnalysisEstimator ProjectToPrincipalComponents(this TransformsCatalog.ProjectionTransforms catalog, params PcaTransform.ColumnInfo[] columns)
 => new PrincipalComponentAnalysisEstimator(CatalogUtils.GetEnvironment(catalog), columns);
Esempio n. 4
0
 /// <summary>Initializes a new instance of <see cref="PrincipalComponentAnalysisEstimator"/>.</summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="inputColumn">Input column to apply PrincipalComponentAnalysis on.</param>
 /// <param name="outputColumn">Optional output column. Null means <paramref name="inputColumn"/> is replaced.</param>
 /// <param name="weightColumn">The name of the weight column.</param>
 /// <param name="rank">The number of principal components.</param>
 /// <param name="overSampling">Oversampling parameter for randomized PrincipalComponentAnalysis training.</param>
 /// <param name="center">If enabled, data is centered to be zero mean.</param>
 /// <param name="seed">The seed for random number generation.</param>
 public static PrincipalComponentAnalysisEstimator ProjectToPrincipalComponents(this TransformsCatalog.ProjectionTransforms catalog,
                                                                                string inputColumn,
                                                                                string outputColumn = null,
                                                                                string weightColumn = PrincipalComponentAnalysisEstimator.Defaults.WeightColumn,
                                                                                int rank            = PrincipalComponentAnalysisEstimator.Defaults.Rank,
                                                                                int overSampling    = PrincipalComponentAnalysisEstimator.Defaults.Oversampling,
                                                                                bool center         = PrincipalComponentAnalysisEstimator.Defaults.Center,
                                                                                int?seed            = null)
 => new PrincipalComponentAnalysisEstimator(CatalogUtils.GetEnvironment(catalog),
                                            inputColumn, outputColumn, weightColumn, rank, overSampling, center, seed);
 /// <summary>
 /// Takes columns filled with a vector of floats and computes global contrast normalization of it.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="columns"> Describes the parameters of the gcn-normaliztion process for each column pair.</param>
 public static GlobalContrastNormalizingEstimator GlobalContrastNormalize(this TransformsCatalog.ProjectionTransforms catalog, params LpNormalizingTransformer.GcnColumnInfo[] columns)
 => new GlobalContrastNormalizingEstimator(CatalogUtils.GetEnvironment(catalog), columns);
 /// <summary>
 /// Takes column filled with a vector of floats and computes global contrast normalization of it.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="outputColumnName">Name of the column resulting from the transformation of <paramref name="inputColumnName"/>.</param>
 /// <param name="inputColumnName">Name of column to transform. If set to <see langword="null"/>, the value of the <paramref name="outputColumnName"/> will be used as source.</param>
 /// <param name="substractMean">Subtract mean from each value before normalizing.</param>
 /// <param name="useStdDev">Normalize by standard deviation rather than L2 norm.</param>
 /// <param name="scale">Scale features by this value.</param>
 /// <example>
 /// <format type="text/markdown">
 /// <![CDATA[
 /// [!code-csharp[GlobalContrastNormalize](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ProjectionTransforms.cs?range=1-6,12-112)]
 /// ]]>
 /// </format>
 /// </example>
 public static GlobalContrastNormalizingEstimator GlobalContrastNormalize(this TransformsCatalog.ProjectionTransforms catalog, string outputColumnName, string inputColumnName = null,
                                                                          bool substractMean = LpNormalizingEstimatorBase.Defaults.GcnSubstractMean,
                                                                          bool useStdDev     = LpNormalizingEstimatorBase.Defaults.UseStdDev,
                                                                          float scale        = LpNormalizingEstimatorBase.Defaults.Scale)
 => new GlobalContrastNormalizingEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, inputColumnName, substractMean, useStdDev, scale);
 /// <summary>
 /// Takes columns filled with a vector of floats and computes L-p norm of it.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="columns"> Describes the parameters of the lp-normalization process for each column pair.</param>
 public static LpNormalizingEstimator LpNormalize(this TransformsCatalog.ProjectionTransforms catalog, params LpNormalizingTransformer.LpNormColumnInfo[] columns)
 => new LpNormalizingEstimator(CatalogUtils.GetEnvironment(catalog), columns);
 /// <summary>
 /// Takes column filled with a vector of floats and computes L-p norm of it.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="outputColumnName">Name of the column resulting from the transformation of <paramref name="inputColumnName"/>.</param>
 /// <param name="inputColumnName">Name of column to transform. If set to <see langword="null"/>, the value of the <paramref name="outputColumnName"/> will be used as source.</param>
 /// <param name="normKind">Type of norm to use to normalize each sample.</param>
 /// <param name="subMean">Subtract mean from each value before normalizing.</param>
 /// <example>
 /// <format type="text/markdown">
 /// <![CDATA[
 /// [!code-csharp[LpNormalize](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ProjectionTransforms.cs?range=1-6,12-112)]
 /// ]]>
 /// </format>
 /// </example>
 public static LpNormalizingEstimator LpNormalize(this TransformsCatalog.ProjectionTransforms catalog, string outputColumnName, string inputColumnName = null,
                                                  LpNormalizingEstimatorBase.NormalizerKind normKind = LpNormalizingEstimatorBase.Defaults.NormKind, bool subMean = LpNormalizingEstimatorBase.Defaults.LpSubstractMean)
 => new LpNormalizingEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, inputColumnName, normKind, subMean);
 /// <summary>
 /// Takes columns filled with a vector of floats and maps its to a random low-dimensional feature space.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="columns">The input columns to use for the transformation.</param>
 public static RandomFourierFeaturizingEstimator CreateRandomFourierFeatures(this TransformsCatalog.ProjectionTransforms catalog, params RandomFourierFeaturizingTransformer.ColumnInfo[] columns)
 => new RandomFourierFeaturizingEstimator(CatalogUtils.GetEnvironment(catalog), columns);
Esempio n. 10
0
 /// <summary>
 /// Takes column filled with a vector of floats and maps its to a random low-dimensional feature space.
 /// </summary>
 /// <param name="catalog">The transform's catalog.</param>
 /// <param name="outputColumnName">Name of the column resulting from the transformation of <paramref name="inputColumnName"/>.</param>
 /// <param name="inputColumnName">Name of column to transform. If set to <see langword="null"/>, the value of the <paramref name="outputColumnName"/> will be used as source.</param>
 /// <param name="newDim">The number of random Fourier features to create.</param>
 /// <param name="useSin">Create two features for every random Fourier frequency? (one for cos and one for sin).</param>
 /// <example>
 /// <format type="text/markdown">
 /// <![CDATA[
 /// [!code-csharp[CreateRandomFourierFeatures](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/ProjectionTransforms.cs?range=1-6,12-112)]
 /// ]]>
 /// </format>
 /// </example>
 public static RandomFourierFeaturizingEstimator CreateRandomFourierFeatures(this TransformsCatalog.ProjectionTransforms catalog,
                                                                             string outputColumnName,
                                                                             string inputColumnName = null,
                                                                             int newDim             = RandomFourierFeaturizingEstimator.Defaults.NewDim,
                                                                             bool useSin            = RandomFourierFeaturizingEstimator.Defaults.UseSin)
 => new RandomFourierFeaturizingEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, inputColumnName, newDim, useSin);