Ejemplo n.º 1
0
 public Config(OneHotVectorOutputKind outputKind, KeyValueOrder order, int max, Action <ValueToKeyMappingTransformer.TermMap> onFit)
 {
     OutputKind = outputKind;
     Order      = order;
     Max        = max;
     OnFit      = onFit;
 }
Ejemplo n.º 2
0
 /// <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: Multiarray, array or binary encoded data.</param>
 /// <param name="order">How the Id for each value would be assigined: by occurrence or by value.</param>
 /// <param name="maxItems">Maximum number of ids to keep during data scanning.</param>
 /// <param name="onFit">Called upon fitting with the learnt enumeration on the dataset.</param>
 public static Vector <float> OneHotEncoding(this Vector <string> input, OneHotVectorOutputKind outputKind = DefOut, KeyValueOrder order = DefSort, int maxItems = DefMax,
                                             ToKeyFitResult <ReadOnlyMemory <char> > .OnFit onFit          = null)
 {
     Contracts.CheckValue(input, nameof(input));
     return(new ImplVector <string>(input, new Config(outputKind, order, maxItems, Wrap(onFit))));
 }