dotnet / machinelearning-modelbuilder

Simple UI tool to build custom machine learning models.
Creative Commons Attribution 4.0 International
264 stars 56 forks source link

Best way to reference ML model from another project? & Suggestion: new project type ML library #1662

Open torronen opened 3 years ago

torronen commented 3 years ago

Question: What is the best way to reference ML model created by model builder in another project? At the moment, I am copying the .zip files manually to all projects, but it is not a good way as number of models increase in the solution.

A feature like below could help in it.

Feature suggestion

Is your feature request related to a problem? Please describe. Models may need to be shared between projects. At the moment, the project templates could not be referenced by other projects without taking care of manually copying the .zip file.

Describe the solution you'd like There coulde be a third project type for "ML Library" on the Consume page image

When referencing from another project, the zip file should be copied along to bin folder. Otherwise, .zip file is not found when running the prediction. If zip file is copied manually, then it also needs to be updated everytime on all projects referencing.

beccamc commented 3 years ago

Thanks for the suggestion Antti!

@Briacht to take a look.

briacht commented 3 years ago

Hi @torronen ! I think it would be a good idea to add "Class library" to the Project templates.

I'm curious, when you are opening Model Builder, do you normally right-click and "Add > Machine Learning Model" to the project in which you'd like to use the model? Or what does that workflow look like when you Add > Machine Learning Model in Visual Studio?

torronen commented 3 years ago

@briacht Good question. That is probably the reason for the question :) Actually, maybe out of habit, I am not sure I even considered adding to the main application. I could consider adding the full .mbconfig file + other files directly to main application using it. Only problem is if the same model would be used by multiple projects, then we probably would need to turn it as a web API, or have some way to update the files in each project.

So far: I've had a "temporary" project for training models and saving the training logs (contents in the Output window). I have mostly used Model Building for experimenting with different data and seeing how altering the dataset might affect. Most of them are never used in production, just for me to get some ideas.

On cases, when I just need a simple app, I've copied the parts of the consumption code + zip file to the main app.

On actual production cases, I've created a class library for consuming the ML model, and pushed to Nuget feed on Azure DevOps. Finally, I've referenced this in the main app or just informed the lead dev about the Nuget. It has not yet been a reality, but it would be ideal that multiple projects would reuse the ML model. That way, any new progress on the model could be updated on all of the projects along with other updates from our Nuget.

luisquintanilla commented 1 year ago