Skip to content

Commit 925f7df

Browse files
committed
Merge remote-tracking branch 'origin/master' into singlis/ova
2 parents 5093549 + 767206f commit 925f7df

File tree

198 files changed

+2195
-2085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+2195
-2085
lines changed

build/Dependencies.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<GoogleProtobufPackageVersion>3.5.1</GoogleProtobufPackageVersion>
1616
<LightGBMPackageVersion>2.2.3</LightGBMPackageVersion>
1717
<MicrosoftMLOnnxRuntimePackageVersion>0.2.1</MicrosoftMLOnnxRuntimePackageVersion>
18-
<MlNetMklDepsPackageVersion>0.0.0.7</MlNetMklDepsPackageVersion>
18+
<MlNetMklDepsPackageVersion>0.0.0.8</MlNetMklDepsPackageVersion>
1919
<ParquetDotNetPackageVersion>2.1.3</ParquetDotNetPackageVersion>
2020
<SystemDrawingCommonPackageVersion>4.5.0</SystemDrawingCommonPackageVersion>
2121
<SystemIOFileSystemAccessControl>4.5.0</SystemIOFileSystemAccessControl>

docs/code/MlNetCookBook.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ var someRows = mlContext
303303
// This will give the entire dataset: make sure to only take several row
304304
// in case the dataset is huge. The is similar to the static API, except
305305
// you have to specify the column name and type.
306-
var featureColumns = transformedData.GetColumn<string[]>(mlContext, "AllFeatures")
307-
.Take(20).ToArray();
306+
var featureColumns = transformedData.GetColumn<string[]>(transformedData.Schema["AllFeatures"])
307+
308308
```
309309
## How do I train a regression model?
310310

@@ -637,7 +637,7 @@ var pipeline =
637637
var normalizedData = pipeline.Fit(trainData).Transform(trainData);
638638

639639
// Inspect one column of the resulting dataset.
640-
var meanVarValues = normalizedData.GetColumn<float[]>(mlContext, "MeanVarNormalized").ToArray();
640+
var meanVarValues = normalizedData.GetColumn<float[]>(normalizedData.Schema["MeanVarNormalized"]).ToArray();
641641
```
642642

643643
## How do I train my model on categorical data?
@@ -682,8 +682,8 @@ var loader = mlContext.Data.CreateTextLoader(new[]
682682
// Load the data.
683683
var data = loader.Load(dataPath);
684684

685-
// Inspect the first 10 records of the categorical columns to check that they are correctly load.
686-
var catColumns = data.GetColumn<string[]>(mlContext, "CategoricalFeatures").Take(10).ToArray();
685+
// Inspect the first 10 records of the categorical columns to check that they are correctly read.
686+
var catColumns = data.GetColumn<string[]>(data.Schema["CategoricalFeatures"]).Take(10).ToArray();
687687

688688
// Build several alternative featurization pipelines.
689689
var pipeline =
@@ -699,8 +699,8 @@ var pipeline =
699699
var transformedData = pipeline.Fit(data).Transform(data);
700700

701701
// Inspect some columns of the resulting dataset.
702-
var categoricalBags = transformedData.GetColumn<float[]>(mlContext, "CategoricalBag").Take(10).ToArray();
703-
var workclasses = transformedData.GetColumn<float[]>(mlContext, "WorkclassOneHotTrimmed").Take(10).ToArray();
702+
var categoricalBags = transformedData.GetColumn<float[]>(transformedData.Schema["CategoricalBag"]).Take(10).ToArray();
703+
var workclasses = transformedData.GetColumn<float[]>(transformedData.Schema["WorkclassOneHotTrimmed"]).Take(10).ToArray();
704704

705705
// Of course, if we want to train the model, we will need to compose a single float vector of all the features.
706706
// Here's how we could do this:
@@ -756,8 +756,8 @@ var loader = mlContext.Data.CreateTextLoader(new[]
756756
// Load the data.
757757
var data = loader.Load(dataPath);
758758

759-
// Inspect the message texts that are load from the file.
760-
var messageTexts = data.GetColumn<string>(mlContext, "Message").Take(20).ToArray();
759+
// Inspect the message texts that are read from the file.
760+
var messageTexts = data.GetColumn<string>(data.Schema["Message"]).Take(20).ToArray();
761761

762762
// Apply various kinds of text operations supported by ML.NET.
763763
var pipeline =

docs/samples/Microsoft.ML.Samples/Dynamic/FastTreeRegression.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace Microsoft.ML.Samples.Dynamic
66
{
77
public static class FastTreeRegression
88
{
9+
// This example requires installation of additional nuget package <a href="https://www.nuget.org/packages/Microsoft.ML.FastTree/">Microsoft.ML.FastTree</a>.
910
public static void Example()
1011
{
1112
// Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging,

docs/samples/Microsoft.ML.Samples/Dynamic/FeatureSelectionTransform.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public static void Example()
8282
};
8383

8484
// Print the data that results from the transformations.
85-
var countSelectColumn = transformedData.GetColumn<VBuffer<float>>(ml, "FeaturesCountSelect");
86-
var MISelectColumn = transformedData.GetColumn<VBuffer<float>>(ml, "FeaturesMISelect");
85+
var countSelectColumn = transformedData.GetColumn<VBuffer<float>>(transformedData.Schema["FeaturesCountSelect"]);
86+
var MISelectColumn = transformedData.GetColumn<VBuffer<float>>(transformedData.Schema["FeaturesMISelect"]);
8787
printHelper("FeaturesCountSelect", countSelectColumn);
8888
printHelper("FeaturesMISelect", MISelectColumn);
8989

docs/samples/Microsoft.ML.Samples/Dynamic/KeyToValueValueToKey.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static void Example()
6060
};
6161

6262
// Preview of the DefaultKeys column obtained after processing the input.
63-
var defaultColumn = transformedData_default.GetColumn<VBuffer<uint>>(ml, defaultColumnName);
63+
var defaultColumn = transformedData_default.GetColumn<VBuffer<uint>>(transformedData_default.Schema[defaultColumnName]);
6464
printHelper(defaultColumnName, defaultColumn);
6565

6666
// DefaultKeys column obtained post-transformation.
@@ -71,7 +71,7 @@ public static void Example()
7171
// 9 10 11 12 13 6
7272

7373
// Previewing the CustomizedKeys column obtained after processing the input.
74-
var customizedColumn = transformedData_customized.GetColumn<VBuffer<uint>>(ml, customizedColumnName);
74+
var customizedColumn = transformedData_customized.GetColumn<VBuffer<uint>>(transformedData_customized.Schema[customizedColumnName]);
7575
printHelper(customizedColumnName, customizedColumn);
7676

7777
// CustomizedKeys column obtained post-transformation.
@@ -87,7 +87,7 @@ public static void Example()
8787
transformedData_default = pipeline.Fit(trainData).Transform(trainData);
8888

8989
// Preview of the DefaultColumnName column obtained.
90-
var originalColumnBack = transformedData_default.GetColumn<VBuffer<ReadOnlyMemory<char>>>(ml, defaultColumnName);
90+
var originalColumnBack = transformedData_default.GetColumn<VBuffer<ReadOnlyMemory<char>>>(transformedData_default.Schema[defaultColumnName]);
9191

9292
foreach (var row in originalColumnBack)
9393
{

docs/samples/Microsoft.ML.Samples/Dynamic/LdaTransform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static void Example()
3737
var transformed_data = transformer.Transform(trainData);
3838

3939
// Column obtained after processing the input.
40-
var ldaFeaturesColumn = transformed_data.GetColumn<VBuffer<float>>(ml, ldaFeatures);
40+
var ldaFeaturesColumn = transformed_data.GetColumn<VBuffer<float>>(transformed_data.Schema[ldaFeatures]);
4141

4242
Console.WriteLine($"{ldaFeatures} column obtained post-transformation.");
4343
foreach (var featureRow in ldaFeaturesColumn)

docs/samples/Microsoft.ML.Samples/Dynamic/LogisticRegression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static void Example()
7373
var metrics = ml.BinaryClassification.Evaluate(dataWithPredictions);
7474

7575
Console.WriteLine($"Accuracy: {metrics.Accuracy}"); // 0.80
76-
Console.WriteLine($"AUC: {metrics.Auc}"); // 0.64
76+
Console.WriteLine($"AUC: {metrics.AreaUnderRocCurve}"); // 0.64
7777
Console.WriteLine($"F1 Score: {metrics.F1Score}"); // 0.39
7878

7979
Console.WriteLine($"Negative Precision: {metrics.NegativePrecision}"); // 0.81

docs/samples/Microsoft.ML.Samples/Dynamic/NgramExtraction.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public static void NgramTransform()
2626
// A pipeline to tokenize text as characters and then combine them together into ngrams
2727
// The pipeline uses the default settings to featurize.
2828

29-
var charsPipeline = ml.Transforms.Text.TokenizeCharacters("Chars", "SentimentText", useMarkerCharacters:false);
30-
var ngramOnePipeline = ml.Transforms.Text.ProduceNgrams("CharsUnigrams", "Chars", ngramLength:1);
29+
var charsPipeline = ml.Transforms.Text.TokenizeCharacters("Chars", "SentimentText", useMarkerCharacters: false);
30+
var ngramOnePipeline = ml.Transforms.Text.ProduceNgrams("CharsUnigrams", "Chars", ngramLength: 1);
3131
var ngramTwpPipeline = ml.Transforms.Text.ProduceNgrams("CharsTwograms", "Chars");
3232
var oneCharsPipeline = charsPipeline.Append(ngramOnePipeline);
3333
var twoCharsPipeline = charsPipeline.Append(ngramTwpPipeline);
@@ -38,30 +38,30 @@ public static void NgramTransform()
3838

3939
// Small helper to print the text inside the columns, in the console.
4040
Action<string, IEnumerable<VBuffer<float>>, VBuffer<ReadOnlyMemory<char>>> printHelper = (columnName, column, names) =>
41-
{
42-
Console.WriteLine($"{columnName} column obtained post-transformation.");
43-
var slots = names.GetValues();
44-
foreach (var featureRow in column)
45-
{
46-
foreach (var item in featureRow.Items())
47-
Console.Write($"'{slots[item.Key]}' - {item.Value} ");
48-
Console.WriteLine("");
49-
}
41+
{
42+
Console.WriteLine($"{columnName} column obtained post-transformation.");
43+
var slots = names.GetValues();
44+
foreach (var featureRow in column)
45+
{
46+
foreach (var item in featureRow.Items())
47+
Console.Write($"'{slots[item.Key]}' - {item.Value} ");
48+
Console.WriteLine("");
49+
}
5050

51-
Console.WriteLine("===================================================");
52-
};
51+
Console.WriteLine("===================================================");
52+
};
5353
// Preview of the CharsUnigrams column obtained after processing the input.
5454
VBuffer<ReadOnlyMemory<char>> slotNames = default;
5555
transformedData_onechars.Schema["CharsUnigrams"].GetSlotNames(ref slotNames);
56-
var charsOneGramColumn = transformedData_onechars.GetColumn<VBuffer<float>>(ml, "CharsUnigrams");
56+
var charsOneGramColumn = transformedData_onechars.GetColumn<VBuffer<float>>(transformedData_onechars.Schema["CharsUnigrams"]);
5757
printHelper("CharsUnigrams", charsOneGramColumn, slotNames);
5858

5959
// CharsUnigrams column obtained post-transformation.
6060
// 'B' - 1 'e' - 6 's' - 1 't' - 1 '<?>' - 4 'g' - 1 'a' - 2 'm' - 1 'I' - 1 ''' - 1 'v' - 2 ...
6161
// 'e' - 1 '<?>' - 2 'd' - 1 '=' - 4 'R' - 1 'U' - 1 'D' - 2 'E' - 1 'u' - 1 ',' - 1 '2' - 1
6262
// 'B' - 0 'e' - 6 's' - 3 't' - 6 '<?>' - 9 'g' - 2 'a' - 2 'm' - 2 'I' - 0 ''' - 0 'v' - 0 ...
6363
// Preview of the CharsTwoGrams column obtained after processing the input.
64-
var charsTwoGramColumn = transformedData_twochars.GetColumn<VBuffer<float>>(ml, "CharsTwograms");
64+
var charsTwoGramColumn = transformedData_twochars.GetColumn<VBuffer<float>>(transformedData_onechars.Schema["CharsUnigrams"]);
6565
transformedData_twochars.Schema["CharsTwograms"].GetSlotNames(ref slotNames);
6666
printHelper("CharsTwograms", charsTwoGramColumn, slotNames);
6767

docs/samples/Microsoft.ML.Samples/Dynamic/Normalizer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static void Example()
4444
var transformedData = transformer.Transform(trainData);
4545

4646
// Getting the data of the newly created column, so we can preview it.
47-
var normalizedColumn = transformedData.GetColumn<float>(ml, "Induced");
47+
var normalizedColumn = transformedData.GetColumn<float>(transformedData.Schema["Induced"]);
4848

4949
// A small printing utility.
5050
Action<string, IEnumerable<float>> printHelper = (colName, column) =>
@@ -72,8 +72,8 @@ public static void Example()
7272
var multiColtransformedData = multiColtransformer.Transform(trainData);
7373

7474
// Getting the newly created columns.
75-
var normalizedInduced = multiColtransformedData.GetColumn<float>(ml, "LogInduced");
76-
var normalizedSpont = multiColtransformedData.GetColumn<float>(ml, "LogSpontaneous");
75+
var normalizedInduced = multiColtransformedData.GetColumn<float>(multiColtransformedData.Schema["LogInduced"]);
76+
var normalizedSpont = multiColtransformedData.GetColumn<float>(multiColtransformedData.Schema["LogSpontaneous"]);
7777

7878
printHelper("LogInduced", normalizedInduced);
7979

docs/samples/Microsoft.ML.Samples/Dynamic/ProjectionTransforms.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void Example()
4141
// The transformed (projected) data.
4242
var transformedData = rffPipeline.Fit(trainData).Transform(trainData);
4343
// Getting the data of the newly created column, so we can preview it.
44-
var randomFourier = transformedData.GetColumn<VBuffer<float>>(ml, nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features));
44+
var randomFourier = transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);
4545

4646
printHelper(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), randomFourier);
4747

@@ -59,7 +59,7 @@ public static void Example()
5959
// The transformed (projected) data.
6060
transformedData = lpNormalizePipeline.Fit(trainData).Transform(trainData);
6161
// Getting the data of the newly created column, so we can preview it.
62-
var lpNormalize= transformedData.GetColumn<VBuffer<float>>(ml, nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features));
62+
var lpNormalize= transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);
6363

6464
printHelper(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), lpNormalize);
6565

@@ -77,7 +77,7 @@ public static void Example()
7777
// The transformed (projected) data.
7878
transformedData = gcNormalizePipeline.Fit(trainData).Transform(trainData);
7979
// Getting the data of the newly created column, so we can preview it.
80-
var gcNormalize = transformedData.GetColumn<VBuffer<float>>(ml, nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features));
80+
var gcNormalize = transformedData.GetColumn<VBuffer<float>>(transformedData.Schema[nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features)]);
8181

8282
printHelper(nameof(SamplesUtils.DatasetUtils.SampleVectorOfNumbersData.Features), gcNormalize);
8383

docs/samples/Microsoft.ML.Samples/Dynamic/StopWordRemoverTransform.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ public static void Example()
5454
};
5555

5656
// Preview the result of breaking string into array of words.
57-
var originalText = transformedDataDefault.GetColumn<VBuffer<ReadOnlyMemory<char>>>(ml, originalTextColumnName);
57+
var originalText = transformedDataDefault.GetColumn<VBuffer<ReadOnlyMemory<char>>>(transformedDataDefault.Schema[originalTextColumnName]);
5858
printHelper(originalTextColumnName, originalText);
5959
// Best|game|I've|ever|played.|
6060
// == RUDE ==| Dude,| 2 |
6161
// Until | the | next | game,| this |is| the | best | Xbox | game!|
6262

6363
// Preview the result of cleaning with default stop word remover.
64-
var defaultRemoverData = transformedDataDefault.GetColumn<VBuffer<ReadOnlyMemory<char>>>(ml, "DefaultRemover");
64+
var defaultRemoverData = transformedDataDefault.GetColumn<VBuffer<ReadOnlyMemory<char>>>(transformedDataDefault.Schema["DefaultRemover"]);
6565
printHelper("DefaultRemover", defaultRemoverData);
6666
// Best|game|I've|played.|
6767
// == RUDE ==| Dude,| 2 |
@@ -70,7 +70,7 @@ public static void Example()
7070

7171

7272
// Preview the result of cleaning with default customized stop word remover.
73-
var customizeRemoverData = transformedDataCustomized.GetColumn<VBuffer<ReadOnlyMemory<char>>>(ml, "RemovedWords");
73+
var customizeRemoverData = transformedDataCustomized.GetColumn<VBuffer<ReadOnlyMemory<char>>>(transformedDataCustomized.Schema["RemovedWords"]);
7474
printHelper("RemovedWords", customizeRemoverData);
7575

7676
// Best|game|I've|ever|played.|

docs/samples/Microsoft.ML.Samples/Dynamic/TextTransform.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static void Example()
5858
};
5959

6060
// Preview of the DefaultTextFeatures column obtained after processing the input.
61-
var defaultColumn = transformedData_default.GetColumn<VBuffer<float>>(ml, defaultColumnName);
61+
var defaultColumn = transformedData_default.GetColumn<VBuffer<float>>(transformedData_default.Schema[defaultColumnName]);
6262
printHelper(defaultColumnName, defaultColumn);
6363

6464
// DefaultTextFeatures column obtained post-transformation.
@@ -68,7 +68,7 @@ public static void Example()
6868
// 0 0.1230915 0.1230915 0.1230915 0.1230915 0.246183 0.246183 0.246183 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1230915 0 0 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.3692745 0.246183 0.246183 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.246183 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.1230915 0.2886751 0 0 0 0 0 0 0 0.2886751 0.5773503 0.2886751 0.2886751 0.2886751 0.2886751 0.2886751 0.2886751
6969

7070
// Preview of the CustomizedTextFeatures column obtained after processing the input.
71-
var customizedColumn = transformedData_customized.GetColumn<VBuffer<float>>(ml, customizedColumnName);
71+
var customizedColumn = transformedData_customized.GetColumn<VBuffer<float>>(transformedData_customized.Schema[customizedColumnName]);
7272
printHelper(customizedColumnName, customizedColumn);
7373

7474
// CustomizedTextFeatures column obtained post-transformation.

docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/FieldAwareFactorizationMachinewWithOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public static void Example()
3232
FieldAwareFactorizationMachine(
3333
new FieldAwareFactorizationMachineBinaryClassificationTrainer.Options
3434
{
35-
FeatureColumn = "Features",
36-
LabelColumn = "Sentiment",
35+
FeatureColumnName = "Features",
36+
LabelColumnName = "Sentiment",
3737
LearningRate = 0.1f,
3838
NumberOfIterations = 10
3939
}));

docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/SDCALogisticRegression.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public static void Example()
6262
var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
6363
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(
6464
new SdcaBinaryTrainer.Options {
65-
LabelColumn = "Sentiment",
66-
FeatureColumn = "Features",
65+
LabelColumnName = "Sentiment",
66+
FeatureColumnName = "Features",
6767
ConvergenceTolerance = 0.01f, // The learning rate for adjusting bias from being regularized
6868
NumThreads = 2, // Degree of lock-free parallelism
6969
}));

docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/MulticlassClassification/LightGbm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static void Example()
4949
var metrics = mlContext.MulticlassClassification.Evaluate(dataWithPredictions, label: "LabelIndex");
5050

5151
// Check if metrics are reasonable.
52-
Console.WriteLine($"Macro accuracy: {metrics.AccuracyMacro:F4}, Micro accuracy: {metrics.AccuracyMicro:F4}.");
52+
Console.WriteLine($"Macro accuracy: {metrics.MacroAccuracy:F4}, Micro accuracy: {metrics.MicroAccuracy:F4}.");
5353
// Console output:
5454
// Macro accuracy: 0.8655, Micro accuracy: 0.8651.
5555

0 commit comments

Comments
 (0)