-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add entrypoint for PFI #4232
Conversation
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 }; |
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.
Awesome change! #Resolved
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.
var loadedData = mlContext.Data.LoadFromBinary(outputDataPath); | ||
Assert.NotNull(loadedData.Schema.GetColumnOrNull("FeatureName")); | ||
Assert.NotNull(loadedData.Schema.GetColumnOrNull("AreaUnderRocCurve")); | ||
Assert.NotNull(loadedData.Schema.GetColumnOrNull("Accuracy")); |
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.
Do we want to verify that the numbers that come back here are correct?
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.
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.
PermutationFeatureImportanceArguments input) | ||
{ | ||
var roles = roleMappedData.Schema.GetColumnRoleNames(); | ||
var featureColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value; |
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.
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).
Fixes #4231
Entrypoint is needed to add PFI to NimbusML
microsoft/NimbusML#92