Using Infer.NET in Silverlight
Infer.NET can now be used from within Silverlight applications, although it is necessary to precompile your inference algorithm. Silverlight support means that you can now write Infer.NET applications that run inside the browser, with the computation happening at the client. You can use Infer.NET with Silverlight 3.0 or later versions.
The Silverlight environment imposes a few limitations on what Infer.NET functionality can be used:
What you need to do
To use Infer.NET in a Silverlight project, you will need:
As an example, we will look at the clinical trial model. There is an example project included in the Infer.NET installation which provides a WPF user interface for this model. We can use this as our non-Silverlight project, to generate the inference code for this model.
The Silverlight project provides a similar user interface, but written in Silverlight. You can find this example project in Samples/C#/ClinicalTrialSilverlight. Here are some snippets, showing how this project calls in to the generated inference code:
The code creates an instance of the generated code, sets properties on it for each observed value and then calls Execute(50) to run 50 iterations of inference. The results of inference for the IsEffective variable are retrieved using the IsEffectiveMarginal() call.
You can see the Clinical Trial example running in Silverlight in your browser on this external page.