<jupyter_start><jupyter_text>This example comes from the ML.NET documentation: https://docs.microsoft.com/en-us/dotnet/api/microsoft.ml.normalizationcatalog.normalizemeanvariance?view=ml-dotnet<jupyter_code>class DataPoint
{
    [VectorType(4)]
    public float[] Features { get; set; }
}
var mlContext = new MLContext();
var samples = new List<DataPoint>()
{
    new DataPoint(){ Features = new float[4] { 1, 1, 3, 0} },
    new DataPoint(){ Features = new float[4] { 2, 2, 2, 0} },
    new DataPoint(){ Features = new float[4] { 0, 0, 1, 0} },
    new DataPoint(){ Features = new float[4] {-1,-1,-1, 1} }
};
var data = mlContext.Data.LoadFromEnumerable(samples);<jupyter_output><empty_output><jupyter_text>NormalizeMeanVariance normalizes the data based on the computed mean and variance of the data. Uses Cumulative distribution function as output.<jupyter_code>var normalize = mlContext.Transforms.NormalizeMeanVariance("Features", useCdf: true);<jupyter_output><empty_output><jupyter_text>NormalizeMeanVariance normalizes the data based on the computed mean and variance of the data.<jupyter_code>var normalizeNoCdf = mlContext.Transforms.NormalizeMeanVariance("Features", useCdf: false);
var normalizeTransform = normalize.Fit(data);
var transformedData = normalizeTransform.Transform(data);
var normalizeNoCdfTransform = normalizeNoCdf.Fit(data);
var noCdfData = normalizeNoCdfTransform.Transform(data);
transformedData.GetColumn<float[]>("Features")
noCdfData.GetColumn<float[]>("Features")<jupyter_output><empty_output><jupyter_text>Let's get transformation parameters. Since we work with only one column we need to pass 0 as parameter for GetNormalizerModelParameters. If we have multiple columns transformations we need to pass index of InputOutputColumnPair.<jupyter_code>normalizeTransform.GetNormalizerModelParameters(0)
normalizeNoCdfTransform.GetNormalizerModelParameters(0)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1078125, 'fraction_numerical': 0.0125, 'mean_word_length': 7.2094017094017095, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '273455', 'license': 'MIT', 'n_tokens_mistral': 607, 'n_tokens_neox': 572, 'n_words': 147, 'path': 'NormalizeMeanVariance.ipynb', 'repo_name': 'rvernagus/simple-ml.net-examples', 'size': '1920'}