probability

Select random row from MySQL (with probability)

I have a MySQL table that has a row called cur_odds which is a percent number with the percent probability that that row will get selected. How do I make a query that will actually select the rows in approximately that frequency when you run through 100 queries for example? I tried the following, but a row that has a probability of 0.3...

Reinforcement learning And POMDP

I am trying to use Multi-Layer NN to implement probability function in Partially Observable Markov Process.. I thought inputs to the NN would be: current state, selected action, result state; The output is a probability in [0,1] (prob. that performing selected action on current state will lead to result state) In training, I fed the in...

randomized quicksort: probability of two elements comparison?

I am reading "Probability and Computing" by M.Mitzenmacher and E.Upfal. I am having problems understanding how the probability of comparison of two elements is calculated. Input: the sorted list (y1,y2,...,yN) of numbers. We are looking for pivot element (randomly). Question: what is probability that two elements yi and yj (j>i) will be...

Determining the chances of an event occurring when it hasn't occurred yet

A user visits my website at time t, and they may or may not click on a particular link I care about, if they do I record the fact that they clicked the link, and also the duration since t that they clicked it, call this d. I need an algorithm that allows me to create a class like this: class ClickProbabilityEstimate { public void r...

How to compute the probability of a multi-class prediction using libsvm?

I'm using libsvm and the documentation leads me to believe that there's a way to output the believed probability of an output classification's accuracy. Is this so? And if so, can anyone provide a clear example of how to do it in code? Currently, I'm using the Java libraries in the following manner SvmModel model = Svm.svm_train(...

C: picking a random item based on probabilities

There's a similar question, I know, but it confused me, so I thought it easier to ask in my way. So I have an array of values, positive and negative. The higher they are, the more probability they have of being chosen. I'm having trouble actually figuring out how to assign the probabilities and then randomly choose one. I'm guessing the...

Function calculating the probability of a letter in an sentence

I have a function that is supposed to calculate the number of times a letter occurs in a sentence, and based on that, calculate the probability of it occurring in the sentence. To accomplish this, I have a sentence: The Washington Metropolitan Area is the most educated and affluent metropolitan area in the United States. An array o...

Probability and Neural Networks

Is it a good practice to use sigmoid or tanh output layers in Neural networks directly to estimate probabilities? i.e the probability of given input to occur is the output of sigmoid function in the NN EDIT I wanted to use neural network to learn and predict the probability of a given input to occur.. You may consider the input as Stat...

The mathematics of Schellings segregation model

For those who don't know the model. You can read this pdf. I want to find what is the probability that 2 nodes are each others neighbors when the algorithm converges (i.e. when all nodes are happy). Here's the model in a gist. You have a grid (say 10x10). You have nodes of two kind (red and green) 45 each. So we have 10 empty s...

Computationally simple Pseudo-Gaussian Distribution with varying mean and standard deviation?

This picture from wikipedia has a nice example of the sort of functions I'd ideally like to generate http://en.wikipedia.org/wiki/File:Normal_Distribution_PDF.svg Right now I'm using the Irwin-Hall Distribution, which is more or less a Polynomial approximation of the Gaussian distribution...basically, you use uniform random number gene...

How can I find out how many rows of a matrix satisfy a rather complicated criterion (in R)?

As an example, here is a way to get a matrix of all possible outcomes of rolling 4 (fair) dice. z <- as.matrix(expand.grid(c(1:6),c(1:6),c(1:6),c(1:6))) As you may already have understood, I'm trying to work out a question that was closed, though, in my opinion, it's a challenging one. I used counting techniques to solve it (I mean by...

how to use random bits to simulate a fair 26-sided die?

How do I use a random number generator that gives bits (0 or 1) to simulate a fair 26-sided die? I want to use a bitstream to pick letters of the English alphabet such that the odds of any one letter coming up is the same as the odds of any other letter (I know real words aren't like that and have specific frequency distributions for eac...

Generate a matrix of all possible outcomes for throwing n dice (ignoring order)

In cases where order does matter, it's rather easy to generate the matrix of all possible outcomes. One way for doing this is using expand.grid as shown here. What if it doesn't? If I'm right, the number of possible combinations is (S+N-1)!/S!(N-1)!, where S is the number of dice, each with N sides numbered 1 through N. (It is differ...

Probability distribution for sms answer delays

I'm writing an app using sms as communication. I have chosen to subscribe to an sms-gateway, which provides me with an API for doing so. The API has functions for sending as well as pulling new messages. It does however not have any kind of push functionality. In order to do my queries most efficient, I'm seeking data on how long time ...

Histogram matching - image processing - c/c++

Hello I have two histograms. int Hist1[10] = {1,4,3,5,2,5,4,6,3,2}; int Hist1[10] = {1,4,3,15,12,15,4,6,3,2}; Hist1's distribution is of type multi-modal; Hist2's distribution is of type uni-modal with single prominent peak. My questions are Is there any way that i could determine the type of distribution programmatically? How ...

What's the term to describe this combination?

There are 4 items: 1, 2, 3, and 4. If we just allow the following combinations, what should we call them? I forgot it. Is it called nCr? 1 2 3 4 1 2 3 1 2 4 2 3 4 1 2 1 3 1 4 2 3 2 4 3 4 1 2 3 4 ...

Information Modeling

The sensor module in my project consists of a rotating camera, that collects noisy information about moving objects in the surrounding environment. The information consists of distance, angle and relative change of the moving objects.. The limiting view range of the camera makes it essential to rotate the camera periodically to update ...

Confusion Matrix of Bayesian Network

Hi, I'm trying to understand bayesian network. I have a data file which has 10 attributes, I want to acquire the confusion table of this data table ,I thought I need to calculate tp,fp, fn, tn of all fields. Is it true ? if it's then what i need to do for bayesian network. Really need some guidance, I'm lost. ...

Is there a random sampling function for iphone development that can simulate a coin toss?

Is there a random sampling function for the iphone? For example, if you want to flip a coin that returns heads 25% of the times it's flipped, and you want to flip it and see if you get heads this time? I googled for random sampling probability for iphone and couldn't find anything. ...

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 moderate other users' submissions; and these moderations are later metamoderated by an admin. Given this: the registered user A with an ...