Comments (3)
Thanks, you found a bug in Infer.NET. You can work around it by initializing nodes
. Here is one possible initialisation (it doesn't matter which):
nodes[n].InitialiseTo(Variable<Gamma>.Factor(Gamma.PointMass, NoisyNodes[n]));
from infer.
The issue here is that GammaFromMeanAndVariance does not handle stochastic arguments. Factors that handle stochastic arguments are listed on the List of factors and constraints. For example, you can make a Gamma with a stochastic rate, or multiply together two Gamma variables.
from infer.
I changed the code to multiply the Gammas as you suggested, but getting the error below which I'm unable to fix.
double[] data = new double[] {
0.592,
0.708,
0.789,
0.621,
0.873,
1.074,
4.634,
3.945,
2.118,
4.207,
2.884,
1.462,
2.851 };
Range n = new Range(data.Length);
VariableArray<double> nodes = Variable.Array<double>(n).Named("nodes");
//nodes[n] = Variable.GammaFromMeanAndVariance(1, 1).ForEach(n);
VariableArray<double> NoisyNodes = Variable.Array<double>(n).Named("NoisyNodes");
using (var mblock = Variable.ForEach(n))
{
var i = mblock.Index;
var mIs0 = (i == 0);
var mIsGr = (i > 0);
using (Variable.If(mIs0))
{
nodes[n] = Variable.GammaFromMeanAndVariance(1, 1);
}
using (Variable.If(mIsGr))
{
var prevM = i - 1;
nodes[n] = nodes[prevM] * Variable.GammaFromMeanAndVariance(1, 1);
}
NoisyNodes[n] = nodes[n] * Variable.GammaFromMeanAndVariance(1, 1);
}
NoisyNodes.ObservedValue = data;
InferenceEngine engine = new InferenceEngine(new ExpectationPropagation());
Gamma[] postNodes = engine.Infer<Gamma[]>(nodes);
for (int i = 0; i < n.SizeAsInt; i++)
{
Console.WriteLine("{0}: {1}", data[i], postNodes[i]);
}
from infer.
Related Issues (20)
- How to use a precompiled inference model and set more then one prior? HOT 13
- Minor question: where are the formulas related to additive corrections for TruncatedGaussian? HOT 4
- How to define the means, precision, scale and shape in the MixtureOfGaussians, so that they can be used in the precompiled model? HOT 2
- Update a model in Infer with a new observation HOT 1
- `A is not a point mass` HOT 1
- Bayesian Neural Network HOT 1
- .NET 5.0 has reached end of life HOT 1
- Doc comparison to Stan. Update that Stan is turing complete HOT 2
- NuGet package broken in Unity 2021.3.6f1 HOT 1
- NullReferenceException when using Power operator HOT 5
- Matchbox recommender message 7 HOT 12
- SchedulingTransform Error when inferring Gamma.Uniform as Point Estimate HOT 2
- Multivariate hidden markov model questions HOT 1
- Consider open Github discussion HOT 1
- Recommender system tutorial evidence HOT 7
- Streaming data from disk HOT 1
- MotifFinder example is broken
- Infer .NET does not appear to work on .NET 8.0 HOT 2
- Type passed in must be derived from System.Attribute or System.Attribute
- Model compilation issue in Blazor WASM HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infer.