-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Change ML.NET to work with .NET Framework 4.6.1 #1075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| using System.Runtime.CompilerServices; | ||
| using Microsoft.ML.Core.Data; | ||
| using Microsoft.ML.Runtime; | ||
| using Microsoft.ML.Runtime.Data; | ||
| using Microsoft.ML.Runtime.Internal.Utilities; | ||
|
|
||
| namespace Microsoft.ML.StaticPipe.Runtime | ||
|
|
@@ -75,7 +76,7 @@ private static MethodInfo[] InitValueTupleCreateMethods() | |
| var methods = typeof(ValueTuple).GetMethods() | ||
| .Where(m => m.Name == methodName && m.ContainsGenericParameters) | ||
| .OrderBy(m => m.GetGenericArguments().Length).Take(7) | ||
| .Append(typeof(AnalyzeUtil).GetMethod(nameof(UnstructedCreate))).ToArray(); | ||
| .ToArray().AppendElement(typeof(AnalyzeUtil).GetMethod(nameof(UnstructedCreate))); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It feels wrong to allocate an array and immediate throw it away to allocate one 1 element longer. |
||
| return methods; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,7 +342,7 @@ public CoefficientStatistics[] GetCoefficientStatistics(LinearBinaryPredictor pa | |
| return null; | ||
|
|
||
| var order = GetUnorderedCoefficientStatistics(parent, schema).OrderByDescending(stat => stat.ZScore).Take(paramCountCap - 1); | ||
| return order.Prepend(new CoefficientStatistics("(Bias)", bias, stdError, zScore, pValue)).ToArray(); | ||
| return order.Prepend(new[] { new CoefficientStatistics("(Bias)", bias, stdError, zScore, pValue) }).ToArray(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, we have our own
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have an overload of this method that takes a params T[], so this still works with older versions of .NET. I thought it would be better to call the same overload independent of the framework, so I changed it. In reply to: 221026867 [](ancestors = 221026867) |
||
| } | ||
|
|
||
| public void SaveText(TextWriter writer, LinearBinaryPredictor parent, RoleMappedSchema schema, int paramCountCap) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this type only has enumerable constructor, so you end up with 3 arrays for each param. One that is size N, and two that are size N+1. If you keep it as an enumerable, you can reduce this. It can be further reduced if you have a constructor that takes an array with reference semantics.
It's also somewhat odd that TransformerChain has copy semantics for constructor params, but EstimatorChain has reference semantics (and thus doesn't have this array copy problem).