Issues when retraining a model

DJamin 386 Reputation points

Dear experts,

I am following the retraining page and I have issues :

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

    // Load data preparation pipeline  
    ITransformer dataPrepPipeline = mlContext.Model.Load("", out dataPrepPipelineSchema);  
    // Load trained model  
    ITransformer trainedModel = mlContext.Model.Load("", 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 file in the output directory.
-> So I have assumed that everything goes into the 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

.NET Machine learning
.NET Machine learning
.NET: Microsoft Technologies based on the .NET software framework.Machine learning: A type of artificial intelligence focused on enabling computers to use observed data to evolve new behaviors that have not been explicitly programmed.
154 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Ding,Xiaoxia 0 Reputation points

    I have the same problem!

    0 comments No comments