(Apologies for the earlier spam reply now deleted)
We do have code in to learn shape of a gamma (which would give you dof), but it is not working correctly right now (it is still a work in progress). The best you can do is learn the rate of a gamma which relates to the variance of the student-t (considered
as a Gaussian with uncertain precision). So in the code below, shape can only be a constant or observed, whereas rate can be a random variable.
double[] xdata = new double[] {1, 2, 3};
//var shape = Variable.GammaFromShapeAndRate(2, 2).Named("shape");
var shape = 1.0;
var rate = Variable.GammaFromShapeAndRate(2, 2).Named("rate");
var tau = Variable.GammaFromShapeAndRate(shape, rate).Named("tau");
var mean = 1.0;
var n = new Range(xdata.Length).Named("n");
var x = Variable.Array<double>(n).Named("x");
x[n] = Variable.GaussianFromMeanAndPrecision(mean, tau).ForEach(n);
x.ObservedValue = xdata;
var engine = new InferenceEngine(new VariationalMessagePassing());
Console.WriteLine("rate = {0}", engine.Infer(rate));
John