/// <summary>
 /// Converts the categorical value into an indicator array by hashing categories into certain value and using that value as the index in the array.
 /// </summary>
 /// <param name="input">Incoming data.</param>
 /// <param name="outputKind">Specify the output type of indicator array: array or binary encoded data.</param>
 /// <param name="hashBits">Amount of bits to use for hashing.</param>
 /// <param name="seed">Seed value used for hashing.</param>
 /// <param name="ordered">Whether the position of each term should be included in the hash.</param>
 /// <param name="invertHash">Limit the number of keys used to generate the slot name to this many. 0 means no invert hashing, -1 means no limit.</param>
 public static Vector <float> OneHotHashEncoding(this Scalar <string> input, OneHotHashScalarOutputKind outputKind = (OneHotHashScalarOutputKind)DefOut,
                                                 int hashBits = DefHashBits, uint seed = DefSeed, bool ordered = DefOrdered, int invertHash = DefInvertHash)
 {
     Contracts.CheckValue(input, nameof(input));
     return(new ImplScalar <string>(input, new Config((OneHotHashVectorOutputKind)outputKind, hashBits, seed, ordered, invertHash)));
 }
コード例 #2
0
 /// <summary>
 /// Converts the categorical value into an indicator array by hashing categories into certain value and using that value as the index in the array.
 /// </summary>
 /// <param name="input">Incoming data.</param>
 /// <param name="outputKind">Specify the output type of indicator array: array or binary encoded data.</param>
 /// <param name="numberOfBits">Amount of bits to use for hashing.</param>
 /// <param name="seed">Seed value used for hashing.</param>
 /// <param name="ordered">Whether the position of each term should be included in the hash.</param>
 /// <param name="maximumNumberOfInverts">During hashing we constuct mappings between original values and the produced hash values.
 /// Text representation of original values are stored in the slot names of the  metadata for the new column.Hashing, as such, can map many initial values to one.
 /// <paramref name="maximumNumberOfInverts"/> specifies the upper bound of the number of distinct input values mapping to a hash that should be retained.
 /// <value>0</value> does not retain any input values. <value>-1</value> retains all input values mapping to each hash.</param>
 public static Vector <float> OneHotHashEncoding(this Scalar <string> input, OneHotHashScalarOutputKind outputKind = (OneHotHashScalarOutputKind)DefOut,
                                                 int numberOfBits = DefNumberOfBits, uint seed = DefSeed, bool ordered = DefOrdered, int maximumNumberOfInverts = DefMaximumNumberOfInverts)
 {
     Contracts.CheckValue(input, nameof(input));
     return(new ImplScalar <string>(input, new Config((OneHotHashVectorOutputKind)outputKind, numberOfBits, seed, ordered, maximumNumberOfInverts)));
 }