public Config(OneHotHashVectorOutputKind outputKind, int numberOfBits, uint seed, bool ordered, int maximumNumberOfInverts) { OutputKind = outputKind; NumberOfBits = numberOfBits; Seed = seed; Ordered = ordered; MaximumNumberOfInverts = maximumNumberOfInverts; }
public Config(OneHotHashVectorOutputKind outputKind, int hashBits, uint seed, bool ordered, int invertHash) { OutputKind = outputKind; HashBits = hashBits; Seed = seed; Ordered = ordered; InvertHash = invertHash; }
/// <summary> /// Converts the categorical value into an indicator array by building a dictionary of categories based on the data and using the id in the dictionary 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 Vector <string> input, OneHotHashVectorOutputKind outputKind = DefOut, int hashBits = DefHashBits, uint seed = DefSeed, bool ordered = DefOrdered, int invertHash = DefInvertHash) { Contracts.CheckValue(input, nameof(input)); return(new ImplVector <string>(input, new Config(outputKind, hashBits, seed, ordered, invertHash))); }
/// <summary> /// Converts the categorical value into an indicator array by building a dictionary of categories based on the data and using the id in the dictionary 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 VarVector <string> input, OneHotHashVectorOutputKind outputKind = DefOut, int numberOfBits = DefNumberOfBits, uint seed = DefSeed, bool ordered = DefOrdered, int maximumNumberOfInverts = DefMaximumNumberOfInverts) { Contracts.CheckValue(input, nameof(input)); return(new ImplVector <string>(input, new Config(outputKind, numberOfBits, seed, ordered, maximumNumberOfInverts))); }