Calling Infer.NET from F#This release of Infer.NET is tested with version 1.9.7.8 of F#. This is the version you get from the October 2009 CTP or the Visual Studio 2010 Beta 2. Porting existing C# code to F#If you are taking existing C# Infer.NET example code and porting it to F# there are a couple of issues to bear in mind:
F# WrapperThe F# wrapper consists of a set of type declarations and functionality to make the experience of using Infer.NET more user friendly for the F# programmer. In particular F# uses implicit type inference and has some difficulty disambiguating some Infer.NET types. Calls to some methods therefore need explicit type specification, and these types can get quite complex, especially, for example, for distribution arrays over jagged array domains. Therefore many type declarations are included in the F# wrapper to make such explicit typing much easier. Another issue with calling Infer.NET from F# is the use of imperative constructs which are counter-intuitive for an F# programmer. Hence the wrapper provides functions to call these methods in a more natural way. Complex jagged arrays of data are also difficult to create and assign values to and methods are provided to make this easier and allow assignment of values in a non imperative fashion. Another issue is operator overloading which is provided for comparison of Variable objects. The Wrapper is divided into a set of modules as described below. The ModulesThe F# wrapper is accessed by referencing the FSharpWrapper.dll and including the namespace MicrosoftResearch.Infer.FSharp in an F# script file, or by including references in the Solution Project of an F# program file . It contains the following modules, which can be accessed by calling moduleName.methodName with appropriate arguments, from an F# file. Alternatively use open moduleName to avoid referring to the moduleName each time a module is used.
Using the Methods in the F# WrapperA following description of how to use the methods is divided up by commonly used functionality needed to build models in Infer.NET, which can make use of methods and type declarations from several modules. TutorialsThese tutorials show how to use the F# Wrapper modules to rewrite the C# tutorials provided for Infer.NET in F#
|


