In March, 2019, it was mentioned in a Microsoft machine learning ML.Net presentation by Microsoft Principal Program Manager Cesar De la Torre Llorente that the preliminary ML.Net SDK, version 0.11, did not yet support the Universal Windows Platform (UWP) because of UWP limitations on reflection. I decided to test this proposition by implementing the multiclassification .Net Iris console tutorial, which uses the famous Anderson Iris Flower Data Set, in a UWP Desktop Bridge pure Win32 “fullTrustProcess” and only rely on UWP for the user interface.
Because the original tutorial was implemented as a console program, I decided a Win32 console process could easily be converted into a Win32 AppService, started from the main UWP program, communicating with UWP over an AppServiceConnection.
When originally built using ML.Net version 0.11, the UWP sample did run but always provided blank predictions, regardless of the input used. However, when the sample was upgraded to the current release version, ML.Net 1.0, and the MLDotNetWin32 code updated to the current API, the application did start to provide predictions. However, because ML.Net does not yet officially support UWP, the sample only runs in Debug mode from the Visual Studio debugger. Attempts to start the UWP program from the Start menu results in the application terminating unexpectedly when Windows loads the Win32 AppService process.
These problems aside, this sample does run under Visual Studio 2017 and 2019 in Debug mode and can provide insights into development of ML.Net applications under UWP when that environment becomes officially supported by Microsoft.
The packaging architecture is shown below:
In Visual Studio 2019, the solution looks like this:
The Packaging project is used for publishing and contains references to the UWP and Win32 projects. The resulting UWP application looks like this:
As you can see, we have already clicked the BuildModel button and made a prediction with the Predict button. The values entered are the default values from the Microsoft ML.Net Iris tutorial, and the output is in the green Status area below. These are the same values as those predicted by the Microsoft console application tutorial.
ML.Net is a promising addition to the Microsoft family of machine learning solutions and when it does eventually support the Universal Windows Platform, this sample may provide a point of departure for your own applications.
To look at this tutorial in-depth, you may find it at my GitHub repository at https://www.github.com/PaulaScholz/MLDotNetUWP. It may also be found linked from the Microsoft ML.Net Community Samples page at https://github.com/dotnet/machinelearning-samples/blob/master/docs/COMMUNITY-SAMPLES.md
Good luck, and happy machine learning!