Skip to content
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

Add entrypoint for PFI #4232

Merged
merged 15 commits into from
Sep 28, 2019
Merged

Add entrypoint for PFI #4232

merged 15 commits into from
Sep 28, 2019

Conversation

najeeb-kazmi
Copy link
Member

@najeeb-kazmi najeeb-kazmi commented Sep 20, 2019

Fixes #4231

Entrypoint is needed to add PFI to NimbusML
microsoft/NimbusML#92

@najeeb-kazmi najeeb-kazmi requested a review from a team as a code owner September 20, 2019 00:00
@najeeb-kazmi najeeb-kazmi changed the title [WIP] Add entrypoint for PFI Add entrypoint for PFI Sep 24, 2019
Contracts.Assert(predictor != null, "No predictor found in model");
var transformedData = input.PredictorModel.TransformModel.Apply(env, input.Data);
IDataView result = PermutationFeatureImportanceUtils.GetMetrics(env, predictor, roleMappedData.Schema, transformedData, input);
return new PermutationFeatureImportanceOutput { Metrics = result };
Copy link
Member

@ganik ganik Sep 27, 2019

Choose a reason for hiding this comment

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

Awesome change! #Resolved

Copy link
Member

@ganik ganik left a comment

Choose a reason for hiding this comment

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

:shipit:

var loadedData = mlContext.Data.LoadFromBinary(outputDataPath);
Assert.NotNull(loadedData.Schema.GetColumnOrNull("FeatureName"));
Assert.NotNull(loadedData.Schema.GetColumnOrNull("AreaUnderRocCurve"));
Assert.NotNull(loadedData.Schema.GetColumnOrNull("Accuracy"));
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to verify that the numbers that come back here are correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

We would verify this by loading the same predictor model and data that goes into the PFI node, and applying the same steps to them that the PFI node does, so I don't see the point of doing this.

@najeeb-kazmi najeeb-kazmi merged commit 7fd670f into dotnet:master Sep 28, 2019
PermutationFeatureImportanceArguments input)
{
var roles = roleMappedData.Schema.GetColumnRoleNames();
var featureColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value;

Choose a reason for hiding this comment

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

featureColumnName [](start = 16, length = 17)

All these special roles - features, label, group etc. have properties in RoleMappedSchema, but you need to check first that they are not null. (here and in the other Get***Metrics methods as well).

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.

Add Entry Point for Permutation Feature Importance
5 participants