public ColInfoEx(GcnColumn col, GcnArguments args)
 {
     SubtractMean = col.SubMean ?? args.SubMean;
     NormKind     = (col.UseStdDev ?? args.UseStdDev) ? NormalizerKind.StdDev : NormalizerKind.L2Norm;
     Scale        = col.Scale ?? args.Scale;
     Contracts.CheckUserArg(0 < Scale && Scale < Float.PositiveInfinity, nameof(args.Scale), "scale must be a positive finite value");
 }
        /// <summary>
        /// A helper method to create GlobalContrastNormalizer transform for public facing API.
        /// </summary>
        /// <param name="env">Host Environment.</param>
        /// <param name="input">Input <see cref="IDataView"/>. This is the output from previous transform or loader.</param>
        /// <param name="name">Name of the output column.</param>
        /// <param name="source">Name of the column to be transformed. If this is null '<paramref name="name"/>' will be used.</param>
        /// <param name="subMean">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>
        public static IDataTransform CreateGlobalContrastNormalizer(IHostEnvironment env,
                                                                    IDataView input,
                                                                    string name,
                                                                    string source  = null,
                                                                    bool subMean   = Defaults.GcnSubMean,
                                                                    bool useStdDev = Defaults.UseStdDev,
                                                                    Float scale    = Defaults.Scale)
        {
            var args = new GcnArguments()
            {
                Column = new[] { new GcnColumn()
                                 {
                                     Source = source ?? name,
                                     Name   = name
                                 } },
                SubMean   = subMean,
                UseStdDev = useStdDev,
                Scale     = scale
            };

            return(new LpNormNormalizerTransform(env, args, input));
        }
        /// <summary>
        /// Public constructor corresponding to SignatureDataTransform.
        /// </summary>
        public LpNormNormalizerTransform(IHostEnvironment env, GcnArguments args, IDataView input)
            : base(env, RegistrationName, env.CheckRef(args, nameof(args)).Column,
                   input, TestIsFloatVector)
        {
            Host.AssertNonEmpty(Infos);
            Host.Assert(Infos.Length == Utils.Size(args.Column));

            _exes = new ColInfoEx[Infos.Length];
            for (int i = 0; i < _exes.Length; i++)
            {
                _exes[i] = new ColInfoEx(args.Column[i], args);
            }

            // REVIEW: for now check only global (default) values. Move to Bindings/ColInfoEx?
            if (!args.SubMean && args.UseStdDev)
            {
                using (var ch = Host.Start("Argument validation"))
                {
                    ch.Warning("subMean parameter is false while useStd is true. It is advisable to set subMean to true in case useStd is set to true.");
                }
            }
            SetMetadata();
        }