Not sure what you mean by theta, since there is no theta in your model. Are you referring to the coin-specific probabilities (which are here represented by mint)? You have specified a single probability for all the coins, rather than 4 probabilities. Try modifying your mint parameter to: mint =...

bayesian,bayesian-networks,probability-theory

It's easiest to maintain the joint probability table, and rebuild the CPT from that as needed. Along with the JPT, keep a count of how many examples were used to produce it. When adding the nth example, multiply all probabilities by 1 - 1/n, and then add probability 1/n to...

artificial-intelligence,bayesian,bayesian-networks

You first of all apply the Bayes rule and you get: P(A|B) = P(A) * P(B|A) / P(B) then you sum over the values of a to get: P(A|B) = P(A) * P(B|A) / (sum_{a} P(B,a)) and then you apply the chain rule: P(A|B) = P(A) * P(B|A) / (sum_{a}...

A few problems in your code. In your model you have J and Length. In your data you have j (twice) and length, i.e. no Length or J. In your initial values you have ort which is not a parameter used anywhere in the model and tau which is not...

the type of xx should be the same as the type of bayesian_component right? if you don't want to make xx to be a component of FiniteMixtureModel(this seems to muddy the waters of your type hierarchy), you can explicitly convert the type of xx as a workaround: function gibbs_sampler(fmm::FiniteMixtureModel,...

image-processing,classification,bayesian,prediction,matlab-cvst

There are many possible approaches to a problem like this. One common method is the bag-of-features model. Take a look at this example using the Computer Vision System Toolbox in MATLAB.

matlab,machine-learning,bayesian

The "prior" is the "prior distribution", which is the distribution describing the likelihood of each class. This is relevant when it comes time to look at a new data point and, based on your training data, to decide which class it is. If you know a priori that one class...

I would recommend you dump the images not as pdf, but as png. If you ensure that the png has a high enough resolution, it will be hard to see the difference between the pdf and the png. The png will be much faster than the pdf, speeding up scrolling.

Your lm example can also be written: m1 <- lm(gdp ~ -1 + rain + factor(ccode) + factor(ccode):year) The equivalent JAGS model would be: M <- function() { for(i in 1:N) { gdp[i] ~ dnorm(yhat[i], sd^-2) yhat[i] <- b0[ccode[i]] + b1*rain[i] + b2[ccode[i]]*year[i] } b1 ~ dnorm(0, 0.001) for (j...

This error appears to be due to the ldaFuncs. Apparently they do not like factors when using matrix input. The main problem can be re-created with your test data using mm <- ldaFuncs$fit(train[2:5], train[,1]) ldaFuncs$pred(mm,train[2:5]) # Error in FUN(x, aperm(array(STATS, dims[perm]), order(perm)), ...) : # non-numeric argument to binary operator...

math,machine-learning,probability,bayesian

What you want is the probability of having the right fish given that the detector beeps, which is P(A|B). The P(B|A) = 9999/10000 is the probability of the detector beeping given you have the right fish. However, we don't know if the fish you have is the right one. All...

You have been bit by a sneaky part of Python. The global import of pymc replaced your numpy exp with a different exp. To get the exp you want, you can use np.exp in your sigmoid deterministic. (Where did np. come from, I wonder?) return np.exp(1.0 / (1.0 + np.exp(bs...

If I understand you correctly, you need to sum all Values in the Dictionary, it will give you 100%. Then divide each Value on the received sum. Insert this code before return score;: double sum = score.Values.Sum(); foreach (var name in score.Keys) { score[name] /= sum; } ...

machine-learning,svm,bayesian,logistic-regression

This is a trivial linear model, where you don't even fit the weights of the model, but instead use the constant values. Linear models make deficision using cl(x) = sgn(<w,x>+b) = sgn( SUM w_i x_i + b ) where x is your data point (x_i is ith feature). In your...

python,bayesian,pymc,survival-analysis

For posterity. Thanks to Chris Fonnesbeck for pointing out that the problem was that I did not give W as an argument to idt. This function should be @deterministic def idt(b1=beta, dl0=dL0, W=W): print beta.value fitted = np.exp(np.dot(X, b1) + W[stfips]) yy = (Y[:,:T] * np.outer(fitted, dl0)) return np.transpose(yy) And...

algorithm,machine-learning,bayesian

Columns "Size" and "Price" represent categorical data (well, actually, ordinal, but that's another point). While you do can model "Rating" as categorical value too, it may be bad idea and it'd much better to model your data as numerical. And here's why. The difference in treating data as categorical and...

If you have time, watch this video: https://www.youtube.com/watch?v=IY29uC4uem8 It explain the possibilities and what is responsible for...

Assuming a multinomial distribution for your Color and Size variables, you need to estimate the following parameters : For color: : red probability. : white probability. For size: : probability of being big given being red. : probability of being big given being white. : probability of being small given...

In a manner of speaking, defining an arbitrary posterior distribution is all you can do in the Stan language. But if you are referring specifically to a posterior distribution that is not a composition of distributions that are already defined in Stan, then you can use the increment_log_prob function to...

In the case of bayesglm, you could do sims <- arm::sim(m1.arm, n = 1000) y_sim <- rnorm(n = 1000, mean = [email protected] %*% t(as.matrix(s1)), sd = [email protected]) mean(y_sim) For the (unreleased) rstanarm, it would be similar sims <- as.matrix(m1.stan) y_sim <- rnorm(n = nrow(sims), mean = sims[,1:(ncol(sims)-1)] %*% t(as.matrix(s1)), sd...

r,null,nan,bayesian,bayesian-networks

the catnet package can deal with missing data and is designed for discrete data you can get conditional probabilities using cnProb(bnet,which) here is an example rm(list=ls()) ### generate random data (not simply independent binomials) set.seed(123) n.obs <- 10 a1 <- rbinom(n.obs,1,.3) a2 <- runif(n.obs) a3 <- floor(-3*log(.25+3*a2/4)) a3[a3>=2] <- NA...

bayesian,pymc,multi-level,pymc3

The error means the optimization algorithm finished but returned values that don't make any sense. Usually this is because the maximum isn't well defined. However, this actually worked fine for me. What versions do you have? I have python 2.7, latest pymc3, theano 0.7.0, scipy 0.13...

The basic problem is that with the smaller data set you don't have enough information to estimate the parameters in the model (that is, you have no degrees of freedom). If you run a classical linear regression, you'll see the R-squared of your model with the smaller data is 1....

image-processing,python-3.x,bayesian,pymc

The closest I know of is here: http://nbviewer.ipython.org/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter5_LossFunctions/LossFunctions.ipynb (see Example: Kaggle contest on Observing Dark World) On this thread you asked a specific question: https://github.com/pymc-devs/pymc/issues/653 about finding an array in an image. Here is a first attempt at a model: In that case it seems like you are trying to...

The only way sequential updating works sensibly is in two different models. Specifying them in the same model does not make any sense, since we have no posteriors until after MCMC has completed. In principle, you would examine the distribution of theta1 and specify a prior that best resembles it....

php,mysql,sql,associations,bayesian

You can JOIN back on the Like table and do something like this. SELECT also_like.m_id, COUNT(also_like.m_id) FROM [like] AS did_like JOIN [like] AS also_like ON also_like.u_id = did_like.u_id AND also_like.m_id != did_like.m_id WHERE did_like.m_id = 1 GROUP BY also_like.m_id ORDER BY COUNT(also_like.m_id) Essentially you are getting a list of users...

r,classification,bayesian,random-forest

I'm actually working on a similar issue and have codified an R package that runs randomForest as the local classifier along a pre-defined class hierarchy. you can find it in R-Forge under 'hie-ran-forest'. The package includes two ways to turn the local probabilities into a crisp class. stepwise majority rule-...

This uninformative error is due to the way you have organized your data vector. It is 2 rows by n columns, and PyMC expects it to be n rows by 2 columns. The following modification makes this code (almost) work for me: xy = MvNormal('xy', mu=mean, tau=precision, value=data.T, observed=True) I...

numpy,statistics,scipy,bayesian

I don't know what's wrong with that code. But here are a couple of different ideas to try: (1) Just sum the array elements instead of trying to compute the numerical integrals. It is simpler that way. (Summing the array elements is essentially computing a rectangle rule approximation, which as...