question

DJamin-2804 avatar image
0 Votes"
DJamin-2804 asked DJamin-2804 edited

Issues when retraining a model

Dear experts,

I am following the retraining page and I have issues :
https://docs.microsoft.com/fr-fr/dotnet/machine-learning/how-to-guides/retrain-model-ml-net

1/ I am not clear about where I can find the data_prep_pipeline.zip file ?

     // Load data preparation pipeline
     ITransformer dataPrepPipeline = mlContext.Model.Load("data_preparation_pipeline.zip", out dataPrepPipelineSchema);
        
     // Load trained model
     ITransformer trainedModel = mlContext.Model.Load("ogd_model.zip", out modelSchema);

I have performed training by doing Add/Machine Learning and following the clickable steps.
Then after testing step, I have saved the project and I can only find the model.zip file in the output directory.
-> So I have assumed that everything goes into the model.zip file. And I have used the "ITransformer trainedModel" as "ITransformer dataPrepPipeline".

2/ The line :

         LinearRegressionModelParameters originalModelParameters =
             ((ISingleFeaturePredictionTransformer<object>)trainedModel).Model as LinearRegressionModelParameters;


returns the following error :

 System.InvalidCastException : 'Unable to cast object of type 'Microsoft.ML.Data.TransformerChain`1[Microsoft.ML.ITransformer]' to type 'Microsoft.ML.ISingleFeaturePredictionTransformer`1

How can I solve this?
I hope that someone can help me.

Best regards,
David Jamin

dotnet-ml-big-data
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers