3

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#.

Osama Rizwan
  • 203
  • 1
  • 2
  • 7
mikesneider
  • 131
  • 3

2 Answers2

1

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).

I_Play_With_Data
  • 2,079
  • 2
  • 16
  • 39
1

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.
ebrahimi
  • 1,277
  • 7
  • 20
  • 39
Shamit Verma
  • 2,239
  • 1
  • 8
  • 14