bayesianlogic / blog Goto Github PK
View Code? Open in Web Editor NEWThe BLOG programming language
Home Page: http://bayesianlogic.github.io/
License: BSD 4-Clause "Original" or "Old" License
The BLOG programming language
Home Page: http://bayesianlogic.github.io/
License: BSD 4-Clause "Original" or "Old" License
@lileicc @cberzan @jxwuyi @WilliamCushing
fixed Integer N = 746;
random Integer x ~ Poisson(N);
query x;
it works for N=745 and takes 0.3 seconds. with N=746 it takes 48 seconds and returns 0.
random Real beta1 ~ Gaussian(0,1);
random Real beta2 ~ Gaussian(0,1);
random Real beta3 ~ Gaussian(0,1);
random Real beta4 ~ Gaussian(0,1);
random RealMatrix beta = [beta1, beta2, beta3, beta4];
throws the following error:
./run.sh ~/Desktop/DARPAchallenge/BirdMigration/code/agg_input.blog -n 1
Using fixed random seed for repeatability.
/Users/yberol/Desktop/DARPAchallenge/BirdMigration/code/agg_input.blog::9.48: invalid body of dependency clause
Fatal error: File interpretation halted due to error(s) in "/Users/yberol/Desktop/DARPAchallenge/BirdMigration/code/agg_input.blog".
fixed NaturalNum[] zeros = [0, 0, 0, 0];
fixed NaturalNum[][] i2 = [[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]];
fixed NaturalNum nil = zeros[0];
fixed NaturalNum one = i2[2][2];
random Real[] aVector ~ Dirichlet(1.0, 5);
random Real magnitude(Real[] vector) = sqrt(dot(vector, vector));
random Real[] normalize(Real[] vector) = norm(vector);
@lileicc @cberzan @WilliamCushing
this one works, the problem is we cannot handle double indexing something that has been relationally indexed.
this is good:
random RealMatrix b1_new = newbirds(time[1]);
random Real b1_new_0 = b1_new[0][0];
but this one
random Real c = newbirds(time[1])[0][0];
gives the following error:
Exception in thread "main" java.lang.ClassCastException: java.lang.Double cannot be cast to blog.common.numerical.MatrixLib
at blog.model.BuiltInFunctions$22.getValue(BuiltInFunctions.java:712)
at blog.model.NonRandomFunction.getValue(NonRandomFunction.java:182)
at blog.model.NonRandomFunction.getValueInContext(NonRandomFunction.java:219)
at blog.model.FuncAppTerm.evaluate(FuncAppTerm.java:185)
at blog.model.Clause.getDistrib(Clause.java:169)
at blog.model.DependencyModel.getDistrib(DependencyModel.java:165)
at blog.model.DependencyModel.getDistribWithBinding(DependencyModel.java:150)
at blog.bn.RandFuncAppVar.getDistrib(RandFuncAppVar.java:117)
at blog.sample.ClassicInstantiatingEvalContext.instantiate(ClassicInstantiatingEvalContext.java:168)
at blog.sample.ClassicInstantiatingEvalContext.getOrComputeValue(ClassicInstantiatingEvalContext.java:117)
at blog.sample.ParentRecEvalContext.getValue(ParentRecEvalContext.java:75)
at blog.bn.VarWithDistrib.ensureDetAndSupported(VarWithDistrib.java:129)
at blog.BLOGUtil.ensureDetAndSupported(BLOGUtil.java:49)
at blog.BLOGUtil.ensureDetAndSupportedWithListener(BLOGUtil.java:80)
at blog.sample.LWSampler.nextSample(LWSampler.java:132)
at blog.engine.SamplingEngine.answerQueries(SamplingEngine.java:165)
at blog.Main.run(Main.java:215)
at blog.Main.main(Main.java:173)
type T;
distinct T time[3];
random RealMatrix b1_old ~ Multinomial(100.0, probs);
random RealMatrix b2_old ~ Multinomial(200, probs);
random RealMatrix b3_old ~ Multinomial(400, probs);
random RealMatrix b4_old ~ Multinomial(300, probs);
random RealMatrix TransferMat = vstack(vstack(vstack(transpose(b1_old),transpose(b2_old) ),transpose(b3_old) ),transpose(b4_old) );fixed Real[] probs = [10.0; 5.0; 3.0; 1.0];
random RealMatrix newbirds(T t) = sum(TransferMat);
random RealMatrix b1_new = newbirds(time[1]);
random Real b1_new_0 = b1_new[0][0];
random RealMatrix b2_new = newbirds(time[1]);
random RealMatrix b3_new = newbirds(time[1]);
random RealMatrix b4_new = newbirds(time[1]);
query b1_old;
query b2_old;
query b3_old;
query b4_old;
query TransferMat;
query newbirds(time[1]);
query b1_new;
query b1_new_0;
query b2_new;
query b3_new;
query b4_new;
given a node, get its parent and children nodes
Maven is popular in open source projects. It is easier but more flexible than makefile. It is platform-independent.
Problem found by @yberol : When we observe a list expression, it gets translated to a ListSpec instead of a RealMatrix. Not sure how to fix.
Minimal example:
random RealMatrix foo ~ UniformVector(1.0, 2.0, 3.0, 4.0);
query foo;
outputs
Distribution of values for foo
1.0 [1.2245780056193871; 3.7836042999862167]
whereas
random RealMatrix foo ~ UniformVector(1.0, 2.0, 3.0, 4.0);
obs foo = [1.4; 3.4];
query foo;
outputs
Distribution of values for foo
1.0 [[1.4], [3.4]]
(which means we cannot do transpose() et al)
@lileicc , @cberzan , @WilliamCushing
element wise exponential on scalar, vector, matrix (both fixed/random)
@lileicc @cberzan @WilliamCushing
need repmat of MATLAB for blog.
>> repmat([2,3,4],2,4)
ans =
2 3 4 2 3 4 2 3 4 2 3 4
2 3 4 2 3 4 2 3 4 2 3 4
I will temporally remove all collaborators and make a full recovery.
Please do not edit at the moment!
Lei
it would be useful to print how many time steps the particle filter have processed.
See displayprogress
of MATLAB.
function reverseStr = displayprogress(perc,reverseStr)
msg = sprintf('%3.1f', perc);
fprintf([reverseStr, msg, '%%']);
reverseStr = repmat(sprintf('\b'), 1, length(msg)+1);
end
The folder src/blog/rodrigoexperiments belongs in src/expmt, not in src/blog. If we decide to use some of this code in the main repository, we can integrate it.
Similarly, a number of the .java files in src/blog are not in any subpackages. Those classes used elsewhere should be put into their own packages. Those not used elsewhere need to be moved to src/expmt.
Currently, dblog's semantics fail on function declarations of the type:
random Real Position(Timestep t)
if t == @0
then ~ UniformReal(-10, 10)
else ~ Gaussian(Position(Prev(t)), 2);
The reason is that there seems to be no provision to differentiate between variables and 0-ary function calls. For example, t is parsed as a 0-ary function call. Shortly afterwards, the semantic correctness checks fail since there is no function named t.
There are some comments in the code indicating that SymbolTerm's should be used in the abstract syntax tree to represent both variables and 0-ary function calls. However, SymbolTerms don't appear integrated with the rest of the code yet. Code needs to be added to do this integration.
I've written up some thoughts about the interface we can provide in blog to allow Andreas and Yanif to proceed on the parallelization effort and about the library refactoring in general:
At a high level, parallelization should proceed by allowing separate threads to create samples independently. The key ingredient should be the addition of a sampling class, Sample.java. The Sampler class will use the nextSample method to create a sample. Each thread will have its own Sampler object. A thread will repeatedly call sampler.makeSample() to obtain Samples. The Samples will be added to a SamplerManager Class which provides a thread safe queue to which generated Samples are added. Once N samples are generated, the SamplerManager signals all the Sampler threads to stop sampling. It then uses the gathered samples to answer the desired query. This setup is general enough to allow for LWSamplers and MHSamplers. Particle Filters could fit in this framework easily as well. Each particle will correspond to a sample. Samples will have associated PartialWorlds to store information.
To add the overall refactoring effort, we need better representations of BLOG programs. We should add a BlogBayesNet class. This class will serve as a repository for a number of functions currently in BLOGUtil, such as ensureDetAndSupported.The class will maintain a DGraph that represents the bayes net structure of the Random variables. This bayes net is currently in the partial world. By moving it to BlogBayesNet we can ensure that all functions touching the random variables are gathered together. The Evidence and Query variables should be part of this class as well. (A BlogBayesNet class would fulfill the purpose of the CBN class we discussed earlier; the issue is that CBN would not be the right name for the class, since CBN's can be infinite and event dependent, while BlogBayesNet's only hold concrete information). Each PartialWorld should have an associated BlogBayesNet.
The above discussion is a little long, so I've summarized the key points:
Possible starter task for @chrisgioia64.
Profiler run shows that DBLOGUtil.getTimestepIndex()
indirectly does a lot of memory allocation. It converts the BayesNetVar to a String, and then does a regex match on the String to extract the timestep the variable refers to. Very inefficient. There should be an easier way to get the timestep out of a BayesNetVar.
I am going to rearrange a few scripts. Afterwards,
makefile
will contain all build commands, no need to have seperate compile.sh
and gen_parser.sh
make
will compile the sourcemake parser
will re-generate the parser (only if you changed blog.flex
or blog.cup
)run.sh
will be renamed to blog
run_pf.sh
will be renamed to dblog
*.bat
) will be kept.type Location;
distinct Location l[16];
random RealMatrix F1(Location src) ~ UniformVector(-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5,-2.5,2.5); // windspeed feature
obs F1(l[0]) = [1.410751850246407; 1.4976456434275582; 0.28166721933972383; -1.2139307163871753; -0.750881347576537; 1.9633685007549087; 0.7736194603537214; 0.5627808753445622; 2.0962147886425795; -0.2972131875614892; -2.2785014560321857; -0.026045724222645283; 0.7403013928912143; -0.1078053971031947; 2.2321671669701866; -1.6663925748672366];
query F1(l[0]);
throws the following error:
Exception in getProb for variable F1(l[0])
Fatal error:
The value passed to the uniform vector distribution's getProb method must be a column vector.
java.lang.IllegalArgumentException: The value passed to the uniform vector distribution's getProb method must be a column vector.
at blog.distrib.UniformVector.checkArgs(UniformVector.java:128)
at blog.distrib.UniformVector.getLogProb(UniformVector.java:102)
at blog.world.AbstractPartialWorld$DefaultInfoUpdater.updateVarInfo(AbstractPartialWorld.java:785)
at blog.world.AbstractPartialWorld.updateParentsAndProbs(AbstractPartialWorld.java:893)
at blog.world.AbstractPartialWorld.updateParentsAndProbs(AbstractPartialWorld.java:481)
at blog.world.AbstractPartialWorld.getLogProbOfValue(AbstractPartialWorld.java:213)
at blog.model.Evidence.getEvidenceLogProb(Evidence.java:328)
at blog.model.Evidence.getEvidenceLogProb(Evidence.java:312)
at blog.sample.LWSampler.supportEvidenceAndCalculateLogWeight(LWSampler.java:151)
at blog.sample.LWSampler.nextSample(LWSampler.java:131)
at blog.engine.SamplingEngine.answerQueries(SamplingEngine.java:165)
at blog.Main.run(Main.java:215)
at blog.Main.main(Main.java:173)
Exception in thread "main" java.lang.Error: Fatal error:
at blog.common.Util.fatalError(Util.java:516)
at blog.common.Util.fatalError(Util.java:489)
at blog.common.Util.fatalError(Util.java:473)
at blog.world.AbstractPartialWorld$DefaultInfoUpdater.updateVarInfo(AbstractPartialWorld.java:795)
at blog.world.AbstractPartialWorld.updateParentsAndProbs(AbstractPartialWorld.java:893)
at blog.world.AbstractPartialWorld.updateParentsAndProbs(AbstractPartialWorld.java:481)
at blog.world.AbstractPartialWorld.getLogProbOfValue(AbstractPartialWorld.java:213)
at blog.model.Evidence.getEvidenceLogProb(Evidence.java:328)
at blog.model.Evidence.getEvidenceLogProb(Evidence.java:312)
at blog.sample.LWSampler.supportEvidenceAndCalculateLogWeight(LWSampler.java:151)
at blog.sample.LWSampler.nextSample(LWSampler.java:131)
at blog.engine.SamplingEngine.answerQueries(SamplingEngine.java:165)
at blog.Main.run(Main.java:215)
at blog.Main.main(Main.java:173)
It is related to issue #134.
Efficient techniques for generating binomial variates exist:
http://delivery.acm.org/10.1145/50000/42381/p216-kachitvichyanukul.pdf?ip=128.32.46.192&id=42381&acc=ACTIVE%20SERVICE&key=CA367851C7E3CE77.3158474DDFAA3F10.4D4702B0C3E38B35.4D4702B0C3E38B35&CFID=328804659&CFTOKEN=39072998&__acm__=1398821672_e0569d312aa40e219748c14a4d8610d2
This paper should be studied, and in particular BTPE should be implemented, because it best fits the needs of BLOG concerning binomial variate generation.
Possible starter task for @chrisgioia64.
Profiler shows that the Util.debug()
calls in AbstractPartialWorld.setValue()
waste a lot of memory. Example:
Util.debug("Setting var: " + var + " to " + value + ", replacing "
+ oldValue);
When BLOG is run in non-verbose mode, Util.debug() is a noop. But the string concatenation above is still performed, and it wastes time and allocates a lot of small String objects which are then never used. (In my profiler run, this was one of the top object-allocation hot spots.)
Possible solutions:
http://stackoverflow.com/a/2466662/744071
http://stackoverflow.com/a/6023505/744071
http://stackoverflow.com/a/6016955/744071
@lileicc @cberzan
For a uniform random variable defined on Uniform[Range] the probability is 1/Range if in the range and zero else. This causes problem in the birds migration branch as all the features are defined as uniform random variables and their total log-probability becomes so low -240K which is lower than the negligible_log_weight constant in the sampler.
The solution is to change the uniform distribution getProb such that it returns 1 when in the range and zero else and for getLogProb it should be 0 when in the range and -Inf else.
requires immediate attention.
@jxwuyi @lileicc @cberzan
instead of following
random Real a(Timestep t){
if t==@0 then ~ Gaussian(0,1)
else if t==@10 then ~ Gaussian(0,1)
else if t==@20 then ~ Gaussian(0,1)
else ~ Gaussian(100,1)
};
query a(@0);
query a(@13);
query a(@20);
we would like to have
random Real a(Timestep t){
if mod(t,10) == 0 ~ Gaussian(0,1)
else ~ Gaussian(100,1)
};
@tejasvsrinivasan @lileicc @cberzan
This one works fine:
fixed Real[] probs = [10.0; 5.0; 3.0; 1.0];
fixed RealMatrix initial_value = [100, 200, 300, 400];
random RealMatrix birds(Timestep t){
if t==@0 then = initial_value
else ~ Multinomial(1000, probs)
};
query birds(@0);
query birds(@1);
query birds(@2);
this one however fails:
fixed Real[] probs = [10.0; 5.0; 3.0; 1.0];
fixed RealMatrix initial_value = [100, 200, 300, 400];
random RealMatrix birds(Timestep t){
if t==@0 then = [100, 200, 300, 400]
else ~ Multinomial(1000, probs)
};
query birds(@0);
query birds(@1);
query birds(@2);
./run.sh ~/Desktop/DARPAchallenge/BirdMigration/code/blog_issue_ex.blog -n 1
Using fixed random seed for repeatability.
(no location): Illegal value for deterministic distribution: [100, 200, 300, 400]
/Users/yberol/Desktop/DARPAchallenge/BirdMigration/code/blog_issue_ex.blog::0.0: type checking failed
Fatal error: File interpretation halted due to error(s) in "/Users/yberol/Desktop/DARPAchallenge/BirdMigration/code/blog_issue_ex.blog".
A design to unify implicit set and tuple set.
Previously, implicit set is expressed in
{Blip b : time(b) == @1}
In addition, we have tupleset
{b for Blip b}
We should create a unified syntax.
e.g.
{b for Blip b: time(b) == @1}
or
{b for Blip b if time(b) == @1}
@lileicc @cberzan @WilliamCushing
this one with = works
random RealMatrix b1_old ~ Multinomial(100.0, probs);
random RealMatrix b2_old ~ Multinomial(200, probs);
random RealMatrix b3_old ~ Multinomial(400, probs);
random RealMatrix b4_old ~ Multinomial(300, probs);
random RealMatrix TransferMat = vstack(vstack(vstack(transpose(b1_old),transpose(b2_old) ),transpose(b3_old) ),transpose(b4_old) );
this one with ~ does not
random RealMatrix b1_old ~ Multinomial(100.0, probs);
random RealMatrix b2_old ~ Multinomial(200, probs);
random RealMatrix b3_old ~ Multinomial(400, probs);
random RealMatrix b4_old ~ Multinomial(300, probs);
random RealMatrix TransferMat ~ vstack(vstack(vstack(transpose(b1_old),transpose(b2_old) ),transpose(b3_old) ),transpose(b4_old) );
We will redesign the method interface to make it work for any combination of random/fixed arguments. And optimize it as much as possible.
fixed Real[] probs = [10.0; 5.0; 3.0; 1.0];
random RealMatrix birds(Timestep t){
if t==@0 then = [100 200 300 400]
else = sum( TransferMat(Prev(t)) )
};
random RealMatrix b1(Timestep t) ~ Multinomial(birds(t)[0][0], probs) ;
random RealMatrix b2(Timestep t) ~ Multinomial(birds(t)[0][1], probs) ;
random RealMatrix b3(Timestep t) ~ Multinomial(birds(t)[0][2], probs) ;
random RealMatrix b4(Timestep t) ~ Multinomial(birds(t)[0][3], probs) ;
random RealMatrix TransferMat(Timestep t) = vstack(vstack(vstack( transpose(b1(t)), transpose(b2(t)) ), transpose(b3(t)) ), transpose(b4(t)) ) ;
query birds(@1);
query birds(@2);
Currently, only & and | are supported operators. A number of examples rely on other operators. For example, aircraft-wandering.dblog has code:
if Position(t) > -7 & Position(t) < 7
then ~ TabularCPD({0 -> 0.0, 1 -> 1.0})
else ~ TabularCPD({0 -> 1.0, 1 -> 0.0});
The extra operators will require adding a few more model classes to handle representation.
Use this issue to accumulate FAQs from first-time users. We will then put it on our website before the summer school.
-r
.-n
.fixed Integer foo(Integer a, Integer b) = a + b
work? (Presumably we will fix this by the summer school.) (works now!๏ผbloglint <filename>
random RealMatrix a = [x, y, z];
@lileicc @cberzan @WilliamCushing
for the following
random RealMatrix beta1 ~ UniformReal(0, 30);
random RealMatrix beta2 ~ UniformReal(0, 30);
random RealMatrix a = vstack(beta1,beta2);
query beta1;
query beta2;
//query a;
get
Distribution of values for beta1
1.0 6.737340168581614
Distribution of values for beta2
1.0 23.508128999586503
but for
random RealMatrix beta1 ~ UniformReal(0, 30);
random RealMatrix beta2 ~ UniformReal(0, 30);
random RealMatrix a = vstack(beta1,beta2);
query beta1;
query beta2;
query a;
get the following error
Exception in thread "main" java.lang.ClassCastException: java.lang.Double cannot be cast to blog.common.numerical.MatrixLib
at blog.model.BuiltInFunctions$39.getValue(BuiltInFunctions.java:1050)
at blog.model.NonRandomFunction.getValue(NonRandomFunction.java:182)
at blog.model.NonRandomFunction.getValueInContext(NonRandomFunction.java:219)
at blog.model.FuncAppTerm.evaluate(FuncAppTerm.java:185)
at blog.model.Clause.getDistrib(Clause.java:169)
at blog.model.DependencyModel.getDistrib(DependencyModel.java:165)
at blog.model.DependencyModel.getDistribWithBinding(DependencyModel.java:150)
at blog.bn.RandFuncAppVar.getDistrib(RandFuncAppVar.java:117)
at blog.sample.ClassicInstantiatingEvalContext.instantiate(ClassicInstantiatingEvalContext.java:168)
at blog.sample.ClassicInstantiatingEvalContext.getOrComputeValue(ClassicInstantiatingEvalContext.java:117)
at blog.sample.ParentRecEvalContext.getValue(ParentRecEvalContext.java:75)
at blog.bn.VarWithDistrib.ensureDetAndSupported(VarWithDistrib.java:129)
at blog.BLOGUtil.ensureDetAndSupported(BLOGUtil.java:49)
at blog.BLOGUtil.ensureDetAndSupportedWithListener(BLOGUtil.java:80)
at blog.sample.LWSampler.nextSample(LWSampler.java:132)
at blog.engine.SamplingEngine.answerQueries(SamplingEngine.java:165)
at blog.Main.run(Main.java:215)
at blog.Main.main(Main.java:173)
In the Aircraft Detection problem, assume there are some number of distinct aircrafts. There should be a fast way of querying some property of the Blips that come from Aircraft a.
The tuple set query:
{b for Blip b : Source(b) = a}
should be easily written as something like Blip(Source=a)
or {Blip(Source=a)}
This works:
fixed RealMatrix mu = [0.0; 0.0];
fixed RealMatrix sigma = [1.0, 0.0; 0.0, 2.0];
random RealMatrix x ~ MultivarGaussian(mu, sigma);
query x;
But this doesn't work:
random RealMatrix x ~ MultivarGaussian([0.0; 0.0], [1.0, 0.0; 0.0, 2.0]);
query x;
Error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at blog.model.Clause.initCPD(Clause.java:358)
at blog.model.Clause.compile(Clause.java:323)
at blog.model.DependencyModel.compile(DependencyModel.java:262)
at blog.model.RandomFunction.compile(RandomFunction.java:183)
at blog.model.Model.compile(Model.java:566)
at blog.Main.setup(Main.java:607)
at blog.Main.main(Main.java:171)
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to blog.common.numerical.MatrixLib
at blog.distrib.MultivarGaussian.<init>(MultivarGaussian.java:88)
... 11 more
Error initializing CPD at 1: java.lang.ClassCastException (java.util.ArrayList cannot be cast to blog.common.numerical.MatrixLib)
Encountered 1 errors in compilation phase.
It would be good to be able to query for summary statistics (e.g., log-likelihood of the observed data, MAP estimates of various parameters, etc.) from a BLOG program itself. Even better would be to combine the two. I appreciate any feedback on the following thoughts:
Some support already exists for summary statistics in BLOG models, e.g., https://github.com/lileicc/dblog/blob/master/src/blog/sample/LWSampler.java#L181, making use of it requires code changes. I think the user should be able to call a built-in function LogLikelihood and write something like
//parameters we wish to learn
random Real[] theta ~ ...;
//let's say we have a 1000-dim array of dataPoints
obs ObsValue(dataPoint[0]) = ...;
...
obs ObsValue(dataPoint[999]) = ...;
//return log-likelihood of dataPoint[*]
query LogLikelihood();
One issue is: for what estimation of model parameters should we return LL? If we added ways to easily reference various estimates of parameters (e.g., MAP: query MAP(theta), the current sample: CURRENT(theta), or various other summarizations), we could make the LogLikelihood syntax slightly richer:
This brings up a number of issues to resolve:
There is no result produced by web UI.
Dan and ChengLai
Would you please have a look and fix the bug.
Thanks!
Lei
Currently, maps are processed by a hack:
https://github.com/amatsukawa/dblog/blob/NewCategorical/src/blog/semant/Semant.java#L638
List<ArgSpec> transExprList(ExprList e, boolean allowRandom) {
List<ArgSpec> args = new ArrayList<ArgSpec>();
for (; e != null; e = e.next) {
Object o = transExpr(e.head);
if (o instanceof List)
return (List<ArgSpec>) o;
args.add((ArgSpec) o);
}
// TODO add checking for allowRandom
return args;
}
The use of instanceof is temporary to make the Urn-Ball example work. Currently, the map {Blue -> 0.5, Green -> 0.5}
gets mapped to a List<ArgSpec> = [0.5, 0.5]
This is the way such arguments were processed, before we explicitly introduced the concept of a map in the syntax.
The current implementation makes it impossible to have a map along with other parameters (because the loop terminates as soon as it sees a List). I am currently working on adding a new ArgSpec subclass MapSpec to solve this issue.
In BLOG, we define some library module with the following statement
distribution Real Gaussian(Real mu, Real std) = Gaussian(mu, std);
It defines a Gaussian
distribution, with two Real
parameters, and a Real
return value. Its implementation is the Gaussian
class (which is blog.distrib.Gaussian
).
Equivalently, we could also state
distribution Real Gaussian(Real mu, Real std) = blog.distrib.Gaussian(mu, std);
Related to #136 .
The current way of handling comparison is through ComparisonFormula.java
However, there are several build-in functions LessThan, LessThanOrEqual, GreaterThan, GreaterThanOrEqual. We do not need both.
Bharath, would you please explain a bit why you introduced ComparisonFormula?
Use this issue to track features we need to add for PPAML. If you're working on something, add your name and relevant pull request here.
Things that we're currently working on:
Next steps:
a_i = 2 * b_i
)a_i ~ UnivarGaussian(b_i, eye)
)-k
flag)a_i = f(b_i)
without writing each assignment by hand@lileicc @cberzan @WilliamCushing
instead of vstack(vstack(a,b),c) we should be able to use vstack(a,b,c)
Please vote your preference.
This Issue is also related to the use of braces {}. {} are used both as a Map and Set.
We may need to distinguish them as well.
which one do you think better:
a. keep as it is
b. use {} for Map, and use Set() for set.
c. use {} for Map, use {} for implicit set, but explicit set will dropped, replaced with list, and allow statement like
obs {Ball b} = [B1, B2, B3]
It will do automatic type conversion from list to set internally.
Say I misdeclared the semantic interpretation of this random variable to be a fixed variable rather than a random variable.
fixed Real y ~ Gaussian(0, 2);
I get the misleading error:
Syntax error at character 239 of input
example/ex1.dblog::15.0: unmatched statement, or possible missing semicolon
and the example Burglary
B ~ Beta(1, 2)
pdf of B at p=0 is 2
getProb works fine and returns 2.0 for p = 0
getLogProb returns NaN
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.