0

I have a double variable defined like this:

Variable<double> myValue = 100;

Now I want to print the value on the command-line, but I can't find a way how to do it.

I tried to just print it, but nothing was printed:

Console.WriteLine("Value: {0:f2}", myValue);

Here is the full example code:

using System;
using Microsoft.ML.Probabilistic.Models;

namespace TestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Variable<double> myValue = 100;
            Console.WriteLine("Value: {0:f2}", myValue);
        }
    }
}
Visores
  • 4,008
  • 4
  • 18
  • 29

1 Answers1

1

You could do this

Variable<double> myValue = 100;
Console.WriteLine( "Value: {0:f2}", myValue.ObservedValue );

But take care, although it displays what you want, it may be still not doing quite as you think. Refer to the Infer.NET documentation for the different ways variables can be created to clarify matters. https://dotnet.github.io/infer/userguide/Creating%20variables.html

hnodrog
  • 68
  • 7