Skip to content

We are not getting submodel for LinearBinaryModelParameters after loading model #3967

Closed
@nighotatul

Description

@nighotatul

Hi

After loading model for binary classification we are trying to get submodel and calibrator

but if you see after loading model we write below code

((Microsoft.ML.Calibrators.CalibratedModelParametersBase)((Microsoft.ML.Data.PredictionTransformerBase<Microsoft.ML.IPredictorProducing<float>>)((Microsoft.ML.Data.TransformerChain<Microsoft.ML.ITransformer>)mlModel).LastTransformer).Model).SubModel

but failed to getting sub model which is required for us for
LinearBinaryModelParameters

if you see in CreateModel method we easily get SubModel by writing below code

LinearBinaryModelParameters linearBinaryModelParameters = ((Microsoft.ML.Data.TransformerChain<Microsoft.ML.Data.BinaryPredictionTransformer<Microsoft.ML.Calibrators.CalibratedModelParametersBase<Microsoft.ML.Trainers.LinearBinaryModelParameters, Microsoft.ML.Calibrators.PlattCalibrator>>>)mlModel).LastTransformer.Model.SubModel;

but same code if we writer after loading model the we got exception of casting

please guide us.

mlApp_ex.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions