3
$\begingroup$

I created a model with machine learning. Using the library Accord.NET. I would like to keep the pre-trained model in a file (not in the RAM memory) how this is possible?

Note: not necessary to create the model with Accord.NET could be with Python (TensorFlow, PyTorch, etc) but to use the pre-trained model from my desktop application in C#.

$\endgroup$
1
$\begingroup$

Welcome to the site - great first question!

In your scenario (assuming I understand it correctly) you have a saved model in python right? So, what I would do is create a new API layer (written in python, using something like the Flask framework) and I would create API endpoints for your algorithmic functions (could be as simple as just 1 for your predict function).

From there, you could run that python script on a server and expose that API to the outside world and it will run/respond just like any other REST API service. At that point, it would be fairly trivial to write C# code to access the API (or any other language you want).

| improve this answer | |
$\endgroup$
1
$\begingroup$

One way is to :

  1. Build and train the model in Python (TensorFlow)
  2. Use ml.net Library to execute the model in .net CLR. See the Docs.
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.