-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Movement and Internalization Phase 1 #1587
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
Conversation
src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/MulticlassLogisticRegression.cs
Show resolved
Hide resolved
@@ -15,9 +15,9 @@ | |||
<ItemGroup> | |||
<ProjectReference Include="..\Microsoft.ML.Api\Microsoft.ML.Api.csproj" /> | |||
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" /> | |||
<ProjectReference Include="..\Microsoft.ML.Legacy\Microsoft.ML.Legacy.csproj" /> |
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.
Hi @justinormont , shortly we will be removing this dependency, since we are preparing to delete that project. Pursuant to #689, any code that cannot be easily rewritten to adapt itself to that will have to be removed.
/// amount of boiler plate code. It can also be used when saving to a single stream, | ||
/// for implementors of ICanSaveInBinaryFormat. | ||
/// for implementors of <see cref="ICanSaveInBinaryFormat"/>. | ||
/// </summary> | ||
public sealed partial class ModelSaveContext : IDisposable |
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.
This is somewhat disappointing. I wanted to actually internalize this class altogether. But, I can't, because of the interface ICanSaveModel
, which must be a public interface due to the fact that IDataTransform
does and ITransformer
should descend from it, and the second at least needs co/contravariance. It may be that I will be able to internalize ModelLoadContext
in the future. I already made the constructor on this thing public so people can't just go creating them willy nilly, but I should probably just internalize everything public here with a BestFriend
.
140920f
to
95734e2
Compare
@@ -402,7 +416,7 @@ public override void SaveAsPfa(BoundPfaContext ctx, RoleMappedSchema schema, str | |||
Contracts.Assert(ctx.TokenOrNullForName(outputNames[1]) == probToken.ToString()); | |||
} | |||
|
|||
public override bool SaveAsOnnx(OnnxContext ctx, RoleMappedSchema schema, string[] outputNames) | |||
private protected override sealed bool SaveAsOnnxCore(OnnxContext ctx, RoleMappedSchema schema, string[] outputNames) |
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.
sealed [](start = 35, length = 6)
sealed?
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.
I guess that's completely redundant since the class itself is sealed. I'll remove it, though perhaps this can be in phase 2 if things otherwise look nice?
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.
@@ -15,6 +15,7 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using Microsoft.ML.Runtime.TreePredictor; |
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.
using [](start = 0, length = 5)
sort
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.
47135b7
to
1d61e0b
Compare
@@ -4,7 +4,8 @@ | |||
|
|||
namespace Microsoft.ML.Runtime.CommandLine | |||
{ | |||
public static class SpecialPurpose | |||
[BestFriend] | |||
internal static class SpecialPurpose |
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.
internal [](start = 4, length = 8)
maybe a one line comment about what this is used, like you did for the other ones.
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.
I don't know, you mean the other classes in this folder that I bore out of CmdParser.cs
? I didn't actually add any documentation to them, if they had documentation before I got there, then I copied it out with the class, but this one I guess didn't have any. If it's all the same to you I'll just leave it as it was since I wasn't quite doing a documentation pass, and since it's internal code I'm not certain I see the urgency? Though in principle it should be documented if this is some concept we want to keep...
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.TimeSeries" + PublicKey.Value)] | ||
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.Transforms" + PublicKey.Value)] | ||
|
||
[assembly: WantsToBeBestFriends] |
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.
WantsToBeBestFriends [](start = 11, length = 20)
:)
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.
My professionalism cannot be doubted! 😄
Can we log an issue for it? Or can it be added to an existing issue for refactoring the EntryPoints infrastructure? In reply to: 437277864 [](ancestors = 437277864) Refers to: src/Microsoft.ML.Core/Data/IMlState.cs:12 in 1d61e0b. [](commit_id = 1d61e0b, deletion_comment = False) |
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.Predictor.Tests" + PublicKey.TestValue)] | ||
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.InferenceTesting" + PublicKey.TestValue)] | ||
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.StaticPipelineTesting" + PublicKey.TestValue)] |
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.
The one thing I am concerned about with this plan is that our tests will be able to reference the internal types in our product. This means that we won't be able to ensure that we are exposing the necessary public API for our customer scenarios.
Is it possible to only use IVT between our product assemblies, but not between our tests assemblies and the product?
@@ -7,6 +7,8 @@ | |||
|
|||
namespace Microsoft.ML.Runtime.Ensemble | |||
{ | |||
public delegate void SignatureModelCombiner(PredictionKind kind); |
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.
The other "signature" delegates became internal. Can this be internal as well?
Internalization and sometimes movement of many types. Ongoing work related to #1519 as we try to limit user exposure to internal infrastructure types.
The commits are mostly structured where I'm removing one sort of thing at a time, so if you want to break it up, just compare adjacent commits. It works pretty well, except sometimes I found I hadn't quite completed the job of a prior commit at a later point and didn't feel like rewriting history, so there is a small amount of pollution.
There's no particular reason why I started where I started or stopped where I stopped, except that it's the end of the day.