Skip to content

It is not possible to use PermutationFeatureImportance from a model loaded from disk in F# #3976

Description

@fwaris

I am trying to use PermutationFeatureImportance (PFI) with F# but the F# type system is not resolving ITransformer to ISingleFeaturePredictionTransformer - which is required by PFI.

I believe it is due to IPredictorProducing (and related interfaces) being marked as "internal".

F# supports explicit interfaces and maybe that is the reason for this issue.

Here is a snippet of code that shows what I am trying to do
(I am using the latest bits - v 1.2.0 at the time of this post)

let mutableschema=nullletmdl= ctx.Model.Load(@"F:\fwaris\data\t\analysis\model_cv_LightGbmBinary.bin",&schema)letmdlt= mdl :?> TransformerChain<ITransformer>letm1= mdlt.LastTransformer //debugger shows it is Microsoft.ML.Data.BinaryPredictionTransformer<Microsoft.ML.IPredictorProducing<float>>letscored= mdl.Transform(trainView)
scored.Preview()
ctx.BinaryClassification.PermutationFeatureImportance(m1 :?>_,scored)

@dsyme

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

F#Support of F# languageP1Priority of the issue for triage purpose: Needs to be fixed soon.lightgbmBugs related lightgbmloadsaveBugs related loading and saving data or modelsneed infoThis issue needs more info before triageregressionBugs related regression tasks

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions