Comments (3)
Hi Daniel,
When using bayes-scala for inference on cluster graphs, you specify
discrete CPDs as an array object, so in fact you can use your potential
function and iterate over all CPD indexes in order to specify appropriate
values.
Inference on cluster graphs is pretty much the same for bayesian nets
(normalised probabilities) and markov networks (not normalised
probabilities), so I believe it shall work in both cases.
Let me know if you need more help.
Regards.
Daniel
On 9 February 2014 19:42, Daniel Khashabi [email protected] wrote:
Hi,
I see that you can define the graphical model based on tables of
probabilities of variables (CPD) for Bayes-Scala. Is it possible to define
factors with discriminative features, with arbitrary feature functions? For
example a factor with the following potential functions:
[image: 111]https://f.cloud.github.com/assets/2441454/2120733/c76de34a-91c1-11e3-969b-c846792a48fa.png
and the overal distribution will be of the following form:
[image: 222]https://f.cloud.github.com/assets/2441454/2120738/115fd7e2-91c2-11e3-87a0-47a67fc9d834.pngIn fact, I am not sure, implementation-wise, how different this is from
your examples (like when you have the factors as proper probability
distributions)Thanks
Reply to this email directly or view it on GitHubhttps://github.com//issues/2
.
Daniel Korzekwa
Software Research Engineer
priv: http://danmachine.com
blog: http://blog.danmachine.com
from bayes-scala.
Hi Daniel,
I really appreciate for your explanations.
Let me be a little more specific. Consider the model attached.
There is a function \Phi( ) which gets some x and and given some 'w' gives
a probability for 'y'.
Now Assume that we a training set, pairs of (x1, y1), (x2, y2), (x3, y3),
....
and using this training set, *we want to estimate w *(which is the
parameter of the prediction inside Phi(.) function.)
The Phi(.) function could be any nonlinear function, e.g. exponential,
probit, sigmoid (whichever easier).
In order to estimate w, we need to be able to 'project' on Phi( w^T x)
(right?)
Do you have such example of projection for a nonlinear function among
examples? (I couldn't find anything).
Thanks,
Daniel
On Mon, Feb 10, 2014 at 3:23 AM, Daniel Korzekwa
[email protected]:
Hi Daniel,
When using bayes-scala for inference on cluster graphs, then you specify
discrete cpd as an array object, so in fact you can use your potential
function and iterate over all cpd indexes in order to specify appropriate
values.Inference on cluster graphs is pretty much the same for bayesian nets
(normalised probabilities) and markov networks (not normalised
probabilities), so I believe it shall work in both cases.Let me know if you need more help.
Regards.
DanielOn 9 February 2014 19:42, Daniel Khashabi [email protected]
wrote:Hi,
I see that you can define the graphical model based on tables of
probabilities of variables (CPD) for Bayes-Scala. Is it possible to
define
factors with discriminative features, with arbitrary feature functions?
For
example a factor with the following potential functions:
[image: 111]<
https://f.cloud.github.com/assets/2441454/2120733/c76de34a-91c1-11e3-969b-c846792a48fa.pngand the overal distribution will be of the following form:
[image: 222]<
https://f.cloud.github.com/assets/2441454/2120738/115fd7e2-91c2-11e3-87a0-47a67fc9d834.pngIn fact, I am not sure, implementation-wise, how different this is from
your examples (like when you have the factors as proper probability
distributions)Thanks
Reply to this email directly or view it on GitHub<
https://github.com/danielkorzekwa/bayes-scala/issues/2>
.Daniel Korzekwa
Software Research Engineer
priv: http://danmachine.com
blog: http://blog.danmachine.comReply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-34612247
.
from bayes-scala.
I think that for the model you describe it's better to work with continuous space rather than using table CPDs, for which you would need to discretize your data of {x,w,y}. In the baye-scala, I provide inference on cluster graphs in discrete space only, but also I support loopy belief propagation and expectation propagation on factor graphs, which is more suitable for your problem.
In your model you propose a non-linear likelihood function of p(y|x,w), which often requires using approximation techniques such as expectation propagation (EP). Example of EP model:
https://github.com/danielkorzekwa/bayes-scala/blob/master/doc/trueskill_in_tennis_factor_graph/trueskill_in_tennis_factor_graph.md
Different option is to use linear gaussian likelihood, then the model you describe is simply bayesian linear model, which is easy to work with. For this model you only need two operations on gaussian distributions, product and sum (marginalisation). Note that you can still incorporate non linearity into linear model by working in a feature space (polynomials,sin/cos, exp, etc.), rather than using original input space.
For the bayesian linear model you can use gaussian functions from bayes-scala
https://github.com/danielkorzekwa/bayes-scala/blob/master/src/main/scala/dk/bayes/math/gaussian/CanonicalGaussian.scala
For the non-linear model with e.g. sigmoid likelihood, you would need compute some approximation messages in order to use EP inference from bayes-scala.
Hope this helps, let me know which option you prefer.
from bayes-scala.
Related Issues (20)
- Update scalalogging HOT 3
- Set up codacy code review and add button HOT 2
- deploy bayes-scala for Scala 2.11 to snapshot maven repo HOT 2
- Graphical visualization of Categoricals using Spark Notebook HOT 4
- Replace ejml with breeze HOT 1
- Write a tutorial for 'Walmart Recruiting - Sales in stormy weather'
- Unsetting the value on a Categorical HOT 4
- Non-snapshot release to maven central HOT 4
- Multi task Gaussian process regression
- Implement automated variational inference
- Package structure refactor
- replace inv(K) with invchol(cholesky(K).t) for Hermitian psd matrices (coviarance matrix)
- Use sqDist from bayes-scala-gp for covariance functions
- remove breeze-natives HOT 5
- replace isIdentical/hasUncountable with isClosy/any from breeze
- Implement new factor graph
- typo in scm HOT 1
- truncate function of Gaussian seems not work HOT 1
- Scala 2.12 cross build HOT 8
- EM for continuous bayesian network HOT 1
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 bayes-scala.