Skip to content

Commit d1abbb8

Browse files
committed
merge
2 parents babb484 + e49b1d8 commit d1abbb8

File tree

278 files changed

+2902
-3242
lines changed

Some content is hidden

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

278 files changed

+2902
-3242
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ Console.WriteLine("prediction: " + prediction.Prediction);
9797
```
9898
A cookbook that shows how to use these APIs for a variety of existing and new scenarios can be found [here](docs/code/MlNetCookBook.md).
9999

100+
## API Documentation
101+
102+
See the [ML.NET API Reference Documentation](https://docs.microsoft.com/en-us/dotnet/api/?view=ml-dotnet).
100103

101104
## Samples
102105

build/vsts-ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,12 @@ phases:
234234
nuGetFeedType: internal
235235
feedPublish: MachineLearning
236236

237-
# Temporarily disable myget publishing - https://github.com/dotnet/machinelearning/issues/2244
238-
# - task: MSBuild@1
239-
# displayName: Publish Packages to MyGet Feed
240-
# inputs:
241-
# solution: build/publish.proj
242-
# msbuildArguments: /t:PublishPackages /p:NuGetFeedUrl=$(_NuGetFeedUrl) /p:NuGetApiKey=$(dotnet-myget-org-api-key)
243-
# msbuildVersion: 15.0
237+
- task: MSBuild@1
238+
displayName: Publish Packages to MyGet Feed
239+
inputs:
240+
solution: build/publish.proj
241+
msbuildArguments: /t:PublishPackages /p:NuGetFeedUrl=$(_NuGetFeedUrl) /p:NuGetApiKey=$(dotnet-myget-org-api-key)
242+
msbuildVersion: 15.0
244243

245244
- task: MSBuild@1
246245
displayName: Publish Symbols to SymWeb Symbol Server

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ public static void FeatureSelectionTransform()
4848
// In this example we define a CountFeatureSelectingEstimator, that selects slots in a feature vector that have more non-default
4949
// values than the specified count. This transformation can be used to remove slots with too many missing values.
5050
var countSelectEst = ml.Transforms.FeatureSelection.SelectFeaturesBasedOnCount(
51-
inputColumn: "Features", outputColumn: "FeaturesCountSelect", count: 695);
51+
outputColumnName: "FeaturesCountSelect", inputColumnName: "Features", count: 695);
5252

5353
// We also define a MutualInformationFeatureSelectingEstimator that selects the top k slots in a feature
5454
// vector based on highest mutual information between that slot and a specified label. Notice that it is possible to
5555
// specify the parameter `numBins', which controls the number of bins used in the approximation of the mutual information
5656
// between features and label.
5757
var mutualInfoEst = ml.Transforms.FeatureSelection.SelectFeaturesBasedOnMutualInformation(
58-
inputColumn: "FeaturesCountSelect", outputColumn: "FeaturesMISelect", labelColumn: "Label", slotsInOutput: 5);
58+
outputColumnName: "FeaturesMISelect", inputColumnName: "FeaturesCountSelect", labelColumn: "Label", slotsInOutput: 5);
5959

6060
// Now, we can put the previous two transformations together in a pipeline.
6161
var pipeline = countSelectEst.Append(mutualInfoEst);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ public static void KeyToValue_Term()
3232
string defaultColumnName = "DefaultKeys";
3333
// REVIEW create through the catalog extension
3434
var default_pipeline = new WordTokenizingEstimator(ml, "Review")
35-
.Append(new ValueToKeyMappingEstimator(ml, "Review", defaultColumnName));
35+
.Append(new ValueToKeyMappingEstimator(ml, defaultColumnName, "Review"));
3636

3737
// Another pipeline, that customizes the advanced settings of the TermEstimator.
3838
// We can change the maxNumTerm to limit how many keys will get generated out of the set of words,
3939
// and condition the order in which they get evaluated by changing sort from the default Occurence (order in which they get encountered)
4040
// to value/alphabetically.
4141
string customizedColumnName = "CustomizedKeys";
4242
var customized_pipeline = new WordTokenizingEstimator(ml, "Review")
43-
.Append(new ValueToKeyMappingEstimator(ml, "Review", customizedColumnName, maxNumTerms: 10, sort: ValueToKeyMappingTransformer.SortOrder.Value));
43+
.Append(new ValueToKeyMappingEstimator(ml,customizedColumnName, "Review", maxNumTerms: 10, sort: ValueToKeyMappingTransformer.SortOrder.Value));
4444

4545
// The transformed data.
4646
var transformedData_default = default_pipeline.Fit(trainData).Transform(trainData);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ 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("SentimentText", "Chars", useMarkerCharacters:false);
30-
var ngramOnePipeline = ml.Transforms.Text.ProduceNgrams("Chars", "CharsUnigrams", ngramLength:1);
31-
var ngramTwpPipeline = ml.Transforms.Text.ProduceNgrams("Chars", "CharsTwograms");
29+
var charsPipeline = ml.Transforms.Text.TokenizeCharacters("Chars", "SentimentText", useMarkerCharacters:false);
30+
var ngramOnePipeline = ml.Transforms.Text.ProduceNgrams("CharsUnigrams", "Chars", ngramLength:1);
31+
var ngramTwpPipeline = ml.Transforms.Text.ProduceNgrams("CharsTwograms", "Chars");
3232
var oneCharsPipeline = charsPipeline.Append(ngramOnePipeline);
3333
var twoCharsPipeline = charsPipeline.Append(ngramTwpPipeline);
3434

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void Normalizer()
3333
var transformer = pipeline.Fit(trainData);
3434

3535
var modelParams = transformer.Columns
36-
.First(x => x.Output == "Induced")
36+
.First(x => x.Name == "Induced")
3737
.ModelParameters as NormalizingTransformer.AffineNormalizerModelParameters<float>;
3838

3939
Console.WriteLine($"The normalization parameters are: Scale = {modelParams.Scale} and Offset = {modelParams.Offset}");
@@ -66,7 +66,7 @@ public static void Normalizer()
6666

6767
// Composing a different pipeline if we wanted to normalize more than one column at a time.
6868
// Using log scale as the normalization mode.
69-
var multiColPipeline = ml.Transforms.Normalize(NormalizingEstimator.NormalizerMode.LogMeanVariance, new[] { ("Induced", "LogInduced"), ("Spontaneous", "LogSpontaneous") });
69+
var multiColPipeline = ml.Transforms.Normalize(NormalizingEstimator.NormalizerMode.LogMeanVariance, new[] { ("LogInduced", "Induced"), ("LogSpontaneous", "Spontaneous") });
7070
// The transformed data.
7171
var multiColtransformer = multiColPipeline.Fit(trainData);
7272
var multiColtransformedData = multiColtransformer.Transform(trainData);
@@ -97,7 +97,7 @@ public static void Normalizer()
9797

9898
// Inspect the weights of normalizing the columns
9999
var multiColModelParams = multiColtransformer.Columns
100-
.First(x=> x.Output == "LogInduced")
100+
.First(x=> x.Name == "LogInduced")
101101
.ModelParameters as NormalizingTransformer.CdfNormalizerModelParameters<float>;
102102

103103
Console.WriteLine($"The normalization parameters are: Mean = {multiColModelParams.Mean} and Stddev = {multiColModelParams.Stddev}");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static void OnnxTransformSample()
3535
var mlContext = new MLContext();
3636
var data = GetTensorData();
3737
var idv = mlContext.Data.ReadFromEnumerable(data);
38-
var pipeline = new OnnxScoringEstimator(mlContext, modelPath, new[] { inputInfo.Key }, new[] { outputInfo.Key });
38+
var pipeline = new OnnxScoringEstimator(mlContext, new[] { outputInfo.Key }, new[] { inputInfo.Key }, modelPath);
3939

4040
// Run the pipeline and get the transformed values
4141
var transformedValues = pipeline.Fit(idv).Transform(idv);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public static void TensorFlowScoringSample()
2222
// Create a ML pipeline.
2323
var pipeline = mlContext.Transforms.ScoreTensorFlowModel(
2424
modelLocation,
25-
new[] { nameof(TensorData.input) },
26-
new[] { nameof(OutputScores.output) });
25+
new[] { nameof(OutputScores.output) },
26+
new[] { nameof(TensorData.input) });
2727

2828
// Run the pipeline and get the transformed values.
2929
var estimator = pipeline.Fit(idv);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public static void TextTransform()
2727
// A pipeline for featurization of the "SentimentText" column, and placing the output in a new column named "DefaultTextFeatures"
2828
// The pipeline uses the default settings to featurize.
2929
string defaultColumnName = "DefaultTextFeatures";
30-
var default_pipeline = ml.Transforms.Text.FeaturizeText("SentimentText", defaultColumnName);
30+
var default_pipeline = ml.Transforms.Text.FeaturizeText(defaultColumnName , "SentimentText");
3131

3232
// Another pipeline, that customizes the advanced settings of the FeaturizeText transformer.
3333
string customizedColumnName = "CustomizedTextFeatures";
34-
var customized_pipeline = ml.Transforms.Text.FeaturizeText("SentimentText", customizedColumnName, s =>
34+
var customized_pipeline = ml.Transforms.Text.FeaturizeText(customizedColumnName, "SentimentText", s =>
3535
{
3636
s.KeepPunctuations = false;
3737
s.KeepNumbers = false;

pkg/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
</ItemGroup>
3838

3939
<ItemGroup Condition="'$(IncludeMLNetNotices)' != 'false'">
40-
<Content Include="$(RepoRoot)\THIRD-PARTY-NOTICES.TXT" Pack="true" PackagePath="\" />
41-
<Content Include="$(RepoRoot)\LICENSE" Pack="true" PackagePath="\" />
40+
<Content Include="$(RepoRoot)\THIRD-PARTY-NOTICES.TXT" Pack="true" PackagePath="" />
41+
<Content Include="$(RepoRoot)\LICENSE" Pack="true" PackagePath=""/>
4242
</ItemGroup>
4343

4444
<ItemGroup Condition="'$(IsSymbolsPackage)' != 'true'">

pkg/Microsoft.ML.Mkl.Redist/Microsoft.ML.Mkl.Redist.nupkgproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Authors>Intel</Authors>
55
<TargetFramework>netstandard2.0</TargetFramework>
6-
<PackageLicenseFile>NOTICE.txt</PackageLicenseFile>
6+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
77
<PackageDescription>$(MSBuildProjectName) contains the MKL library redistributed as a NuGet package.</PackageDescription>
88
<PackageTags>$(PackageTags) MLNET MKL</PackageTags>
99
</PropertyGroup>
@@ -14,6 +14,6 @@
1414

1515
<ItemGroup>
1616
<Content Include="..\common\CommonPackage.props" Pack="true" PackagePath="build\netstandard2.0\$(MSBuildProjectName).props" />
17-
<Content Include="$(PackagesDir)\mlnetmkldeps\$(MlNetMklDepsPackageVersion)\LICENSE.txt" Pack="true" PackagePath=".\NOTICE.txt" />
17+
<Content Include="$(PackagesDir)\mlnetmkldeps\$(MlNetMklDepsPackageVersion)\LICENSE.txt" Pack="true" PackagePath="" />
1818
</ItemGroup>
1919
</Project>

pkg/Microsoft.ML.Recommender/Microsoft.ML.Recommender.nupkgproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<ItemGroup>
99
<ProjectReference Include="../Microsoft.ML/Microsoft.ML.nupkgproj" />
1010
<Content Include="..\common\CommonPackage.props" Pack="true" PackagePath="build\netstandard2.0\$(MSBuildProjectName).props" />
11-
<Content Include="$(SourceDir)Native\MatrixFactorizationNative\libmf\COPYRIGHT" Pack="true" PackagePath=".\" />
11+
<Content Include="$(SourceDir)Native\MatrixFactorizationNative\libmf\COPYRIGHT" Pack="true" PackagePath="" />
1212
</ItemGroup>
1313

1414
</Project>

pkg/Microsoft.ML.TensorFlow.Redist/Microsoft.ML.TensorFlow.Redist.nupkgproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<ItemGroup>
2121
<Content Include="..\common\CommonPackage.props" Pack="true" PackagePath="build\netstandard2.0\$(MSBuildProjectName).props" />
22-
<Content Include="$(PackageAssetsPath)$(PackageIdFolderName)\LICENSE.txt" Pack="true" PackagePath=".\" />
23-
<Content Condition="Exists('$(PackageAssetsPath)$(PackageIdFolderName)\THIRD_PARTY_NOTICES.txt')" Include="$(PackageAssetsPath)$(PackageIdFolderName)\THIRD_PARTY_NOTICES.txt" Pack="true" PackagePath=".\" />
22+
<Content Include="$(PackageAssetsPath)$(PackageIdFolderName)\LICENSE.txt" Pack="true" PackagePath="" />
23+
<Content Condition="Exists('$(PackageAssetsPath)$(PackageIdFolderName)\THIRD_PARTY_NOTICES.txt')" Include="$(PackageAssetsPath)$(PackageIdFolderName)\THIRD_PARTY_NOTICES.txt" Pack="true" PackagePath="" />
2424
</ItemGroup>
2525
</Project>

src/Microsoft.ML.Core/CommandLine/CmdParser.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,17 +1359,17 @@ public ArgumentInfo(Type type, Argument argDef, Argument[] args, Dictionary<stri
13591359
private static MethodInfo GetParseMethod(Type type)
13601360
{
13611361
Contracts.AssertValue(type);
1362-
var meth = type.GetMethod("Parse", new[] { typeof(string) });
1363-
if (meth != null && meth.IsStatic && meth.IsPublic && meth.ReturnType == type)
1362+
var meth = type.GetMethod("Parse", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, binder: null, new[] { typeof(string) }, null);
1363+
if (meth != null && meth.IsStatic && !meth.IsPrivate && meth.ReturnType == type)
13641364
return meth;
13651365
return null;
13661366
}
13671367

13681368
private static MethodInfo GetUnparseMethod(Type type)
13691369
{
13701370
Contracts.AssertValue(type);
1371-
var meth = type.GetMethod("TryUnparse", new[] { typeof(StringBuilder) });
1372-
if (meth != null && !meth.IsStatic && meth.IsPublic && meth.ReturnType == typeof(bool))
1371+
var meth = type.GetMethod("TryUnparse", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, binder: null, new[] { typeof(StringBuilder) }, null);
1372+
if (meth != null && !meth.IsPrivate && meth.ReturnType == typeof(bool))
13731373
return meth;
13741374
return null;
13751375
}

src/Microsoft.ML.Core/ComponentModel/ComponentCatalog.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ private void ScanForEntryPoints(LoadableClassInfo info)
468468
var type = info.LoaderType;
469469

470470
// Scan for entry points.
471-
foreach (var methodInfo in type.GetMethods(BindingFlags.Static | BindingFlags.Public))
471+
foreach (var methodInfo in type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
472472
{
473473
var attr = methodInfo.GetCustomAttributes(typeof(TlcModule.EntryPointAttribute), false).FirstOrDefault() as TlcModule.EntryPointAttribute;
474474
if (attr == null)
@@ -727,7 +727,7 @@ internal LoadableClassInfo GetLoadableClassInfo(string loadName, Type signatureT
727727
[BestFriend]
728728
internal IEnumerable<EntryPointInfo> AllEntryPoints()
729729
{
730-
return _entryPoints.AsEnumerable();
730+
return _entryPoints;
731731
}
732732

733733
[BestFriend]

src/Microsoft.ML.Core/Data/IEstimator.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,29 +75,29 @@ internal Column(string name, VectorKind vecKind, ColumnType itemType, bool isKey
7575
}
7676

7777
/// <summary>
78-
/// Returns whether <paramref name="inputColumn"/> is a valid input, if this object represents a
78+
/// Returns whether <paramref name="source"/> is a valid input, if this object represents a
7979
/// requirement.
8080
///
8181
/// Namely, it returns true iff:
8282
/// - The <see cref="Name"/>, <see cref="Kind"/>, <see cref="ItemType"/>, <see cref="IsKey"/> fields match.
83-
/// - The columns of <see cref="Metadata"/> of <paramref name="inputColumn"/> is a superset of our <see cref="Metadata"/> columns.
83+
/// - The columns of <see cref="Metadata"/> of <paramref name="source"/> is a superset of our <see cref="Metadata"/> columns.
8484
/// - Each such metadata column is itself compatible with the input metadata column.
8585
/// </summary>
8686
[BestFriend]
87-
internal bool IsCompatibleWith(Column inputColumn)
87+
internal bool IsCompatibleWith(Column source)
8888
{
89-
Contracts.Check(inputColumn.IsValid, nameof(inputColumn));
90-
if (Name != inputColumn.Name)
89+
Contracts.Check(source.IsValid, nameof(source));
90+
if (Name != source.Name)
9191
return false;
92-
if (Kind != inputColumn.Kind)
92+
if (Kind != source.Kind)
9393
return false;
94-
if (!ItemType.Equals(inputColumn.ItemType))
94+
if (!ItemType.Equals(source.ItemType))
9595
return false;
96-
if (IsKey != inputColumn.IsKey)
96+
if (IsKey != source.IsKey)
9797
return false;
9898
foreach (var metaCol in Metadata)
9999
{
100-
if (!inputColumn.Metadata.TryFindColumn(metaCol.Name, out var inputMetaCol))
100+
if (!source.Metadata.TryFindColumn(metaCol.Name, out var inputMetaCol))
101101
return false;
102102
if (!metaCol.IsCompatibleWith(inputMetaCol))
103103
return false;

src/Microsoft.ML.Core/Data/MetadataUtils.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ internal static bool HasSlotNames(this Schema.Column column, int vectorSize)
327327
public static void GetSlotNames(this Schema.Column column, ref VBuffer<ReadOnlyMemory<char>> slotNames)
328328
=> column.Metadata.GetValue(Kinds.SlotNames, ref slotNames);
329329

330+
public static void GetKeyValues<TValue>(this Schema.Column column, ref VBuffer<TValue> keyValues)
331+
=> column.Metadata.GetValue(Kinds.KeyValues, ref keyValues);
332+
330333
[BestFriend]
331334
internal static void GetSlotNames(RoleMappedSchema schema, RoleMappedSchema.ColumnRole role, int vectorSize, ref VBuffer<ReadOnlyMemory<char>> slotNames)
332335
{

0 commit comments

Comments
 (0)