locked
.NET Core 2.0 support in VS 2017 RRS feed

  • Vraag

  • Hi,

    I am following the BayesPointMachine example to study Bayesian Regression example in Infer.NET. In VS 2017 I selected the project type as ".NET Core 2.0". When I try to compile the application, an exception is thrown at the first line of Infer.NET code:

    Exception thrown: 'System.TypeInitializationException' in Infer.Compiler.dll
    An unhandled exception of type 'System.TypeInitializationException' occurred in Infer.Compiler.dll
    The type initializer for 'MicrosoftResearch.Infer.InferenceEngine' threw an exception.

    The usual message of model compilation is not even printed to the console.

    Is Infer.NET supported in .NET Core 2.0 or should I stick with .NET framework (e.g. 4.6)?

    My program looks like this:

                //
                // Challenger O-ring data
                //
    
                double[] temp = { 66, 70, 69, 68, 67, 72, 73, 70, 57, 63, 70, 78, 67, 53, 67, 75, 70, 81, 76, 79, 75, 76, 58 };
                double[] distress = { 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
    
                Vector[] xdata = new Vector[temp.Length];
                for (int i = 0; i < temp.Length; i++)
                    xdata[i] = Vector.FromArray(temp[i], 1);    // including bias
    
                //
                // Model variables
                //
    
                
                VariableArray<double> y = Variable.Observed(distress);
    
                Range n = y.Range;
    
                VariableArray<Vector> x = Variable.Observed(xdata, n);
    
                Variable<Vector> w = Variable.Random(new VectorGaussian(Vector.Zero(2), PositiveDefiniteMatrix.Identity(2)));
    
                double noise = 0.1;
    
                y[n] = Variable.GaussianFromMeanAndVariance(Variable.InnerProduct(w, x[n]), noise);
    
                //
                // Training: parameter inference
                //
    
                InferenceEngine engine = new InferenceEngine();
    
                VectorGaussian wPosterior = engine.Infer<VectorGaussian>(w);
                Console.WriteLine("Distribution over w = \n" + wPosterior);
    
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
    If Infer.NET is not supported in .NET Core 2.0, are there any plans to make it compatible?

    Thanks



    • Bewerkt door usptact zaterdag 18 november 2017 07:51
    zaterdag 18 november 2017 07:44

Antwoorden

  • You should stick with .NET framework.  .NET Core and .NET Standard didn't even exist when Infer.NET was last released.
    • Als antwoord gemarkeerd door usptact zondag 19 november 2017 01:01
    zaterdag 18 november 2017 08:16
    Eigenaar