locked
Errors in Example 4: Bayes Point Machine & Infer.Net 2.4 (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • goodcoffeecode posted on 11-05-2010 3:53 AM

    http://research.microsoft.com/en-us/um/cambridge/projects/infernet/docs/Bayes%20Point%20Machine%20tutorial.aspx

    This example produces exceptions when using the latest version of the Infer.Net libraries (v.2.4). Initially the following line throws a compilation exception...

    Variable<Vector> w = Variable.Random(new VectorGaussian(new Vector(3), PositiveDefiniteMatrix.Identity(3))).Named("w");

    and needs to be changed to 

    Variable<Vector> w = Variable.Random(new VectorGaussian(Vector.Zero(3), PositiveDefiniteMatrix.Identity(3))).Named("w");

    This then generates the following runtime exception:

    Test method InferenceTests.UnitTest1.Test2 threw exception: 

    System.ArgumentException: VariableArray<Vector> x cannot be indexed by index1. Perhaps you omitted index1 as an argument to the constructor?

    Parameter name: index

    MicrosoftResearch.Infer.Models.Range.CheckCompatible(IModelExpression index, IVariableArray array) in C:\infernetBuilds\29-10-2010_16-40\Compiler\Infer\Models\Range.cs: line 219

    MicrosoftResearch.Infer.Models.VariableArrayBase`2.GetItem(VariableArrayBase`2 array, TItem itemPrototype, IModelExpression[] index) in C:\infernetBuilds\29-10-2010_16-40\Compiler\Infer\Models\VariableArrayBase.cs: line 129

    MicrosoftResearch.Infer.Models.VariableArrayBase`2.get_Item(IModelExpression[] index) in C:\infernetBuilds\29-10-2010_16-40\Compiler\Infer\Models\VariableArrayBase.cs: line 91

    MicrosoftResearch.Infer.Models.VariableArray`2.get_Item(Range range) in C:\infernetBuilds\29-10-2010_16-40\Compiler\Infer\Models\VariableArray.cs: line 62

    InferenceTests.UnitTest1.Test2() in c:\Code\InferenceTests\UnitTest1.cs: line 51

    Hoping someone can suggest a fix for this please.
    Thanks, Chris

    Friday, June 3, 2011 6:07 PM

Answers

  • minka replied on 11-05-2010 4:59 AM

    Thanks for pointing this out.  You can find the correct code in the Examples Browser or the Example Solution (both available via Start -> All Programs -> Infer.NET 2.4).  We will update the website shortly.

    Friday, June 3, 2011 6:07 PM