Skip to content

Commit e8bf494

Browse files
committed
PR review comments
1 parent 8e6a295 commit e8bf494

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/Conversion/MapKeyToVectorMultiColumn.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Samples.Dynamic
77
{
8-
class MapKeyToVectorMultiColumn
8+
public class MapKeyToVectorMultiColumn
99
{
1010
/// This example demonstrates the use of MapKeyToVector by mapping keys to floats[] for multiple columns at once.
1111
/// Because the ML.NET KeyType maps the missing value to zero, counting starts at 1, so the uint values
@@ -30,10 +30,10 @@ public static void Example()
3030
var data = mlContext.Data.LoadFromEnumerable(rawData);
3131

3232
// Constructs the ML.net pipeline
33-
var pipeline = mlContext.Transforms.Conversion.MapKeyToVector(
34-
new[]{
35-
new InputOutputColumnPair ("TimeframeVector", "Timeframe"),
36-
new InputOutputColumnPair ("CategoryVector", "Category") });
33+
var pipeline = mlContext.Transforms.Conversion.MapKeyToVector(new[]{
34+
new InputOutputColumnPair ("TimeframeVector", "Timeframe"),
35+
new InputOutputColumnPair ("CategoryVector", "Category")
36+
});
3737

3838
// Fits the pipeline to the data.
3939
IDataView transformedData = pipeline.Fit(data).Transform(data);
@@ -44,7 +44,7 @@ public static void Example()
4444

4545
Console.WriteLine($" Timeframe TimeframeVector Category CategoryVector");
4646
foreach (var featureRow in features)
47-
Console.WriteLine($"{featureRow.Timeframe}\t\t\t{string.Join(',', featureRow.TimeframeVector)}\t\t\t{featureRow.Category}\t\t{string.Join(',', featureRow.CategoryVector)}");
47+
Console.WriteLine($"{featureRow.Timeframe} {string.Join(',', featureRow.TimeframeVector)} {featureRow.Category} {string.Join(',', featureRow.CategoryVector)}");
4848

4949
// TransformedData obtained post-transformation.
5050
//

src/Microsoft.ML.Data/Data/SchemaDefinition.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ public KeyTypeAttribute()
3232
}
3333

3434
/// <summary>
35-
/// Marks member as <see cref="KeyDataViewType"/>. The <paramref name="count"/> should be set to
36-
/// one more than the maximum value for the keys (to account for missing values).
35+
/// Marks member as <see cref="KeyDataViewType"/> and specifies <see cref="KeyDataViewType"/> cardinality.
36+
/// In case of the attribute being used with int types, the <paramref name="count"/> should be set to one more than
37+
/// the maximum value to account for counting starting at 1 (0 is reserved for the missing KeyType). E.g the cardinality of the
38+
/// 0-9 range is 10.
3739
/// If the values are outside of the specified cardinality they will be mapped to the missing value representation: 0.
3840
/// </summary>
3941
/// <param name="count">Cardinality of <see cref="KeyDataViewType"/>.</param>

0 commit comments

Comments
 (0)