Skip to content

Making Schema implement ISchema explicitly #1894

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

Merged
merged 4 commits into from
Dec 18, 2018

Conversation

Zruty0
Copy link
Contributor

@Zruty0 Zruty0 commented Dec 17, 2018

Addresses #1500

Made Schema implement ISchema explicitly. Removed all calls to the ISchema inteface when Schema is accessed, with the exception of TryGetColumnIndex, which was made internal.

@Zruty0 Zruty0 changed the title Making Schema implement ISchema explicitly [WIP] Making Schema implement ISchema explicitly Dec 17, 2018
@@ -85,7 +85,7 @@ public static void FeatureContributionCalculationTransform_Regression()
var value = row.Features[featureOfInterest];
var contribution = row.FeatureContributions[featureOfInterest];
var percentContribution = 100 * contribution / row.Score;
var name = data.Schema.GetColumnName(featureOfInterest + 1);
var name = data.Schema[(int) (featureOfInterest + 1)].Name;
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Dec 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(int) [](start = 39, length = 5)

why cast to int if it's already int?
To catch overflow? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea, this is Resharper doing the work for me. I believe you are right, it's for the overflow.


In reply to: 242359826 [](ancestors = 242359826)

@Zruty0 Zruty0 force-pushed the pr/more-schema-cleanup branch from 5ecf4ed to 6ed35f0 Compare December 18, 2018 02:00
@Zruty0 Zruty0 changed the title [WIP] Making Schema implement ISchema explicitly Making Schema implement ISchema explicitly Dec 18, 2018
@Zruty0
Copy link
Contributor Author

Zruty0 commented Dec 18, 2018

You can start looking now. Again, biggest changes are in Schema.cs, and the remaining files have been updated to compile. #Resolved

@Zruty0 Zruty0 requested a review from sfilipi December 18, 2018 02:18
@@ -310,38 +300,37 @@ private static Delegate GetMetadataGetterDelegate<TValue>(ISchema schema, int co
return getter;
}

/// <summary>
/// Legacy method to get the column index.
/// DO NOT USE: use <see cref="GetColumnOrNull"/> instead.
Copy link
Contributor

@TomFinley TomFinley Dec 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO NOT USE [](start = 12, length = 10)

I'm guessing using actual Obsolete on this and other code is undesirable? This one also looks very different from the others -- this is [BestFriend] internal while the remainder are explicit, was that intentional, or just an artifact of the work being staged somehow? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 450+ uses, and they cannot be all fixed mechanically with Resharper. So I opted to internal-best-friend it. The rest of the ISchema will be removed, but this one, I think, may stay for longer.

Actually obsolete-ing is going to be quite disruptive to the code base either...


In reply to: 242417023 [](ancestors = 242417023)

@TomFinley
Copy link
Contributor

TomFinley commented Dec 18, 2018

public sealed class Schema : ISchema, IReadOnlyList<Schema.Column>

How close are we to making ISchema itself an internal interface, if not yet deleting it outright? #Resolved


Refers to: src/Microsoft.ML.Core/Data/Schema.cs:25 in 5b17cc4. [](commit_id = 5b17cc4, deletion_comment = False)

Copy link
Contributor

@TomFinley TomFinley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you muchly @Zruty0 !!

@Zruty0
Copy link
Contributor Author

Zruty0 commented Dec 18, 2018

public sealed class Schema : ISchema, IReadOnlyList<Schema.Column>

I will know today. The 2 major blockers was Schema and ColumnBindingsBase.


In reply to: 448109260 [](ancestors = 448109260)


Refers to: src/Microsoft.ML.Core/Data/Schema.cs:25 in 5b17cc4. [](commit_id = 5b17cc4, deletion_comment = False)

Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@Zruty0 Zruty0 merged commit f55f840 into dotnet:master Dec 18, 2018
@Zruty0 Zruty0 deleted the pr/more-schema-cleanup branch December 18, 2018 18:11
@ghost ghost locked as resolved and limited conversation to collaborators Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants