All Questions
Tagged with probability bayesian
80
questions
22
votes
2
answers
7k
views
PyMC3 Bayesian Linear Regression prediction with sklearn.datasets
I've been trying to implement Bayesian Linear Regression models using PyMC3 with REAL DATA (i.e. not from linear function + gaussian noise) from the datasets in sklearn.datasets. I chose the ...
21
votes
5
answers
13k
views
permutation & combinations interview
This is a good one because it's so counter-intuitive:
Imagine an urn filled with balls, two-thirds of which are of one color and one-third of which are of another. One individual has drawn 5 balls ...
12
votes
4
answers
671
views
How to update a matrix of probabilities
I am trying to find/figure out a function that can update probabilities.
Suppose there are three players and each of them get a fruit out of a basket: ["apple", "orange", "...
10
votes
2
answers
889
views
Bayesian inference
I have an instrument that will either pass or fail a series of three tests. The instrument must pass all three tests to be considered successful. How may I use Bayesian inference to look at the ...
8
votes
3
answers
301
views
Way to infer the size of the userbase of a site from sampling taken usernames
Suppose you wanted to estimate the size of a userbase of a site which does not publicize this information.
People are more likely to have acquired different usernames with different probabilities. ...
8
votes
0
answers
888
views
Sampling from a joint distribution in Pyro
I understand how to sample from multidimensional categorical, or multivariate normal (with dependence within each column). For example, for a multivariate categorical, this can be done as below:
...
6
votes
1
answer
3k
views
Inference in a Bayesian Network
I need to perform some inferences on a Bayesian network, such as the example I have created below.
I was looking at doing something like something like this to solve an inference such as P(F| A = ...
4
votes
1
answer
1k
views
Why do we choose Beta distribution as a prior on hypothesis?
I saw machine learning class videos of course 10-701 year 2011 by Tom Mitchell at CMU. He was teaching on topic Maximum Likelihood Estimation when he used Beta distribution as prior on theta, I wonder ...
4
votes
2
answers
3k
views
Using a Naive Bayes Classifier to classify tweets: some problems
Using, amongst other sources, various posts here on Stackoverflow, I'm trying to implement my own PHP classier to classify tweets into a positive, neutral and negative class. Before coding, I need to ...
3
votes
3
answers
1k
views
Calculating spam probability
I am building a website in python/django and want to predict wether a user submission is valid or wether it is spam.
Users have an accept rate on their submissions, like this website has.
Users can ...
3
votes
1
answer
3k
views
Kalman filter prediction in case of missing measurement and only positions are known
I am trying to implement Kalman filter. I only know the positions. The measurements are missing at some time steps. This is how I define my matrices:
Process noise matrix
Q = np.diag([0.001, 0.001])
...
3
votes
1
answer
3k
views
Log likelihood to implement Naive Bayes for Text Classification
I am implementing Naive Bayes algorithm for text classification. I have ~1000 documents for training and 400 documents for testing. I think I've implemented training part correctly, but I am confused ...
3
votes
1
answer
6k
views
Negative BIC values for GaussianMixture in scikit-learn (sklearn)
In scikit-learn, the GaussianMixture object has the method bic(X) that implements the Bayesian Information Criterion to choose the number of components that better fits the data.
This is an example of ...
2
votes
2
answers
7k
views
Estimating Posterior in Python?
I'm new to Bayesian stats and I'm trying to estimate the posterior of a poisson (likelihood) and gamma distribution (prior) in Python. The parameter I'm trying to estimate is the lambda variable in ...
2
votes
1
answer
4k
views
Unsupervised Naive Bayes - how does it work?
So as I understand it, to implement an unsupervised Naive Bayes, we assign random probability to each class for each instance, then run it through the normal Naive Bayes algorithm. I understand that, ...
2
votes
1
answer
300
views
Bayesian Network Probability For Child Node
Given the following Bayesian network determine the probabilities.
On the network shown in Figure 1, suppose that:
P("alternator broken"=true) = 0.02
P("no charging"=true | "alternator broken"=true) =...
2
votes
1
answer
690
views
Bayesian network conditional independency
If we observe that it is cloudy and raining. What is the probability that the grass is wet? The answer would be:
P(W=T|C=T,R =T) = P(W=T|R=T,S=T)*P(S=T|C=T)+P(W=T|R=T,S=F)*P(S=F|C=T)
But if we ...
2
votes
2
answers
172
views
Topic models in a structured document? (or would EM or MCMC work?)
I have a set of documents that each consist of N words. The ith word of each document is selected from a common set of words, Wi={wi1, wi2, wi3, wi4}.
For example, the first word in each document ...
2
votes
0
answers
865
views
Updating Prior with data in python - Beta and Normal Distribution
I have a beta distribution parameterised by alpha = 40, beta = 100. I have data collected, and I want to update the prior with this data.
Apologies in advance, I think I am having a brain freeze ...
2
votes
0
answers
420
views
Tensorflow-Probability. - Saving and restoring checkpoints for bayesian neural network
I'd been looking at the Tensorflow Probability library and trying to modify the example in bayesian network example, hoping that I can save checkpoints and then restore them. I first started trying to ...
2
votes
0
answers
1k
views
Probabilities computation for Naïve Bayes classifier under Weka
I want to understand how the Naive Bayes classifier works with text classification, in particular, how is the calculation of probabilities?
Class
Attribute ...
1
vote
2
answers
2k
views
Baye's rule - how to calculate likelihood
Given is some data, data, which corresponds to a binary sequence of coin flips, where heads are 1's and tails are 0's. Theta is a value between 0 and 1 representing the probability that a coin ...
1
vote
1
answer
842
views
Bayesian curve fitting model [closed]
With respect to bayesian curve fitting, eq 1.68 of Bishop - Pattern recognition
How is the following result derived :
p(t|x, x, t) = Integration{ p(t|x, w)p(w|x, t) } dw
1
vote
1
answer
284
views
direct log probability increment (target += ...) in pymc3 as in stan
In the probabilistic programming language stan, given the data/params blocks:
data {
int N;
real[N] data;
}
params {
real mu;
}
The following model blocks are equivalent:
"Sample ...
1
vote
1
answer
1k
views
Probability - Flu test using Bayes Rule
I have the following question:
You go to the doctor about a strong headache. The doctor randomly selects you for a blood test for flu, which is suspected to affect 1 in 9,000 people in your city. The ...
1
vote
1
answer
2k
views
prob package seems to miscalculate Conditional Probability?
I am using the prob package in R to calculate Conditional probability.
My data set is
Q1 Q2 Q3 Q4
1 1 0 0
0 0 0 0
0 1 0 1
0 1 0 1
I want to calculate prob(Q2 =1 ...
1
vote
1
answer
93
views
Concept of Naive Bayes for demonstration purposes, how to calculate word possibilities
I need to demonstrate the Bayesian spam filter in school.
To do this I want to write a small Java application with GUI (this isn't a problem).
I just want to make sure that I really grasped the ...
1
vote
1
answer
2k
views
How does Laplace Smoothing Effect Prior / Evidence
I have a probability / stats question related to implementing Naive Bayes Classifiers, in particular about implementing Laplace Smoothing to avoid the Zero count issue and overfitting.
From what Ive ...
1
vote
1
answer
65
views
Match Bayesian Networks using Joint Probablity to Network Graph
I'm stuck on a task right now. Given the Joint Probabilities given below, how can I show that they belong exactly to one of the networks (and not to the other two). According to my intuition I would ...
1
vote
1
answer
36
views
unable to get the odds of a user- bayes theorm
I'm trying to solve the question which is quite basic using confusion matrix but my solution is not matching the correct solution.
Q: Let's say we have a drug test that can accurately identify the ...
1
vote
0
answers
28
views
PyMC: Vectorization or Fundamentally Different
is there a fundamental difference between these pymc variable definitions:
r = pymc.Uniform(lower=-1, max=1, size=2)
step = [pymc.Slice(var=[r])]
and
r1 = pymc.Uniform(lower=-1, max=1)
r2 = pymc....
1
vote
1
answer
58
views
Interpreting 'catnet' package's cnProb output for a catnetwork object
I am new to Bayesian Networks. I am trying to use catnet package in R, however, I am having difficulty understanding the output of cnProb() function. For instance, here is a new catnetwork object:
...
1
vote
0
answers
33
views
Data structure for conditional probabilities with updating conditions
I have a list of lists of 4 integers. All integers in the same list are distinct, e.g.,
data = [[8, 9, 3, 0], [3, 8, 4, 9], [7, 9, 6, 4], [3, 6, 4, 8], [0, 5, 3, 7], [0, 9, 4, 2], [9, 0, 1, 5], [3, 2, ...
1
vote
0
answers
121
views
Switchpoint Analysis with MCMC Sampling
I'm currently trying to reproduce the results of the baysian switchpoint analysis covered in the BMH book. (Link to Github) However i'm using a different dataset. I finally got some results but ...
1
vote
0
answers
1k
views
Conditional Probability Matrix in Python for dynamic values
I need to calculate and store a Conditional Probability Table (for a Bayesian Network) which is an extract from a Matrix whose input will be N (number of unique Thresholds for each node) and T(number ...
1
vote
0
answers
22
views
Bayesian a posteriori law of bernouilli law, from observed correlated bernouilli law
Suppose that you have $N$ people passing an exam having 2 yes/no questions.
After seeing the results of $N-1$ people and the result of the first question of the $Nth$ person, I want to know what I can ...
0
votes
4
answers
428
views
I don't understand Bayes' rule [closed]
I know that Bayes' rule is in form of P(A/B)=P(B/A)*P(A)/P(B)
What I don't understand is, what means P(A/B) and P(B/A) ?
Regards.
0
votes
3
answers
82
views
Best possible way to add the likely event and its probability from a cross table in R
Using the mtcars dataset, I have created a cross table as follows -
tab = with(mtcars, ftable(gear, cyl))
tab
Here is how it looks -
cyl 4 6 8
gear
3 1 2 12
4 8 ...
0
votes
1
answer
455
views
Mixture of gaussians not converging in pyMC3
I have a mixture of 3 gaussians but no matter how much I tweak the priors I can't get the posterior means to move from their prior values..
k = 3
n1 = 1000
n2 = 1000
n3 = 1000
n = n1+n2+n3
mean1 = ...
0
votes
3
answers
2k
views
How do I solve this conditional probabilities problem with MATLAB?
If P( cj | xi ) are already known, where i=1,2,...n; j=1,2,...k;
How do I calculate/estimate:
P( cj | xl , xm , xn ), where j=1,2,...k; l,m,n belongs to http://latex.mathoverflow.net/jsMath/fonts/...
0
votes
3
answers
393
views
Simulating data using existing data and probability
I have measured multiple attributes (height, species, crown width, condition etc) for about 1500 trees in a city. Using remote sensing techniques I also have the heights for the rest of the 9000 ...
0
votes
1
answer
1k
views
How to select certain rows in Excel that meet logical criteria of A & B
I have an excel sheet in CSV that has 8 columns A-H and thousands of rows with values 0 or 1 depending on truth value.
I'm looking for the Excel function in which I can select rows where column A and ...
0
votes
1
answer
639
views
Constructing a Cumulative Distribution Function using a multi-variable pdf
I am constructing 2 arbitrary PDFs (probability density functions) from a kernel function and representing them as 2 column vectors lets call them A and B.
Each of these pdf is dependant on each ...
0
votes
1
answer
2k
views
How to create a joint probability table from existing conditioinal probability tables? (CPTs)
I have the following tables ,with the dependencies below :
And I want to create the joint-probability table for P(M,P,W,B) , which looks like this (and of course ,you can assume that the below table ...
0
votes
1
answer
532
views
Different factor graphs from a bayesian network
I was wondering whether it is possible to convert a Bayesian network into several different forms of factor graphs but still hold the same conditional probability from the original Bayesian Network. ...
0
votes
1
answer
210
views
Create a function to calculate Bayes Probability in R
I'm working on a project and i need to create a function in R to calculate the following probability :
P(Y|X) = P(Y and X) / P(X)
by using table and prop.table
Any idea please.
0
votes
1
answer
200
views
Conditional Probability for fake reviews
I am working on a conditional probability question.
A = probability of being legit review
B = probability of guessing correctly
P(A) = 0.98 → P(A’) = 0.02
P(B|A’) = 0.95
P(B|A) = 0.90
The ...
0
votes
1
answer
378
views
Could anybody explain me the independence in bayesian nets?
Could anybody explain me conditional independence in the following cases? Could you give me any other appropriate examples for each case?
0
votes
2
answers
153
views
How to insert probabilities into a matrix?
what would be a good program that could automate and fill out the matrix A?
We have the col vector:
col=c(1,1,2,3,4,5,10,7,7,3,1,5,3,7,6,3,4,2,1,1,2,2,6,4,8,8,9,1,3,2)
col
[1] 1 1 2 3 4 5 10 ...
0
votes
1
answer
113
views
Using naive-bayes for detecting spam
I am implementing a naive bayes spam detector which features are words and I am not sure if I understand the algorithm correctly yet.
This I how I am trying to implement the algorithm:
In the ...