Beispiel #1
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        public override double[] MappingToFeatureSpace(Parameter param)
        {
            var singleValue = param.AsType <float>();
            var doubleValue = Convert.ToDouble(singleValue);

            return(base.MappingToFeatureSpace(Parameter.FromDouble(doubleValue)));
        }
Beispiel #2
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        public override double[] MappingToFeatureSpace(Parameter param)
        {
            var value         = param.AsType <int>();
            var valueAsDouble = Convert.ToDouble(value);

            return(base.MappingToFeatureSpace(Parameter.FromDouble(valueAsDouble)));
        }
Beispiel #3
0
        public override double[] MappingToFeatureSpace(Parameter param)
        {
            if (this.FeatureSpaceDim == 0)
            {
                return(new double[0]);
            }

            var value = param.AsType <object>();
            var x     = Array.BinarySearch(this.Choices, value);

            Contracts.Check(x != -1, $"{value} not contains");

            return(this._option.MappingToFeatureSpace(Parameter.FromInt(x)));
        }
Beispiel #4
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        public override double[] MappingToFeatureSpace(Parameter param)
        {
            var x = param.AsType <double>();

            Contracts.Check(x <= this.Max && x >= this.Min, $"{x} is not within [{this.Min}, {this.Max}]");
            if (this.LogBase)
            {
                var logMax = Math.Log(this.Max);
                var logMin = Math.Log(this.Min);
                var logX   = Math.Log(x);

                return(new[] { logX / (logMax - logMin) - logMin / (logMax - logMin) });
            }
            else
            {
                return(new[] { x / (this.Max - this.Min) - this.Min / (this.Max - this.Min) });
            }
        }