Получить MaximumEntropyModelParameters из модели в ML.Net - PullRequest
0 голосов
/ 01 мая 2020

Создать конвейер:

var pipeline = mlContext.Transforms.Conversion.MapValueToKey("output")
                    .Append(mlContext.Transforms.Concatenate("Features", "pixels"))
                    .Append(mlContext.MulticlassClassification.Trainers.LbfgsMaximumEntropy(labelColumnName: "output", featureColumnName: "Features"))
                    .Append(mlContext.Transforms.Conversion.MapKeyToValue("PredictedLabel"));

Загрузить модель:

DataViewSchema modelSchema = null;
               var model = mlContext.Model.Load("Data.zip", out modelSchema);

var originalModelParameters = ((ISingleFeaturePredictionTransformer<CalibratedModelParametersBase<MaximumEntropyModelParameters, PlattCalibrator>>)model).Model.SubModel; //ERROR

MaximumEntropyModelParameters originalModelParameters =
    ((ISingleFeaturePredictionTransformer<object>)model).Model as MaximumEntropyModelParameters; //ERROR

Сообщение об ошибке: Microsoft.ML.Data.TransformerChain'1[Microsoft.ML.Transforms.KeyToValueMappingTransformer]" in type "Microsoft.ML.ISingleFeaturePredictionTransformer'1[System.Object]".

...