probability

Randomly Generating Combinations From Variable Weights

 ̄綄美尐妖づ 提交于 2020-08-18 07:33:05
问题 VERY IMPORTANT EDIT: All A i are unique . The Question I have a list A of n unique objects. Each object A i has a variable percentage P i . I want to create an algorithm that generates a new list B of k objects ( k < n / 2 and in most cases k is significantly less than n / 2 . E.g. n=231 , k=21 ). List B should have no duplicates and will be populated with objects originating from list A with the following restriction: The probability that an object A i appears in B is P i . What I Have Tried

Sampling without replacement with unequal, dependent probabilities

半世苍凉 提交于 2020-08-05 09:37:36
问题 So from answers to the question, Randomly Generating Combinations From Variable Weights, I've managed to sample without replacement given unequal probabilities. I've implemented this in my particular context and it works great. Now I have access to additional information about my distribution. Specifically, I've been using a neural network to generate these probabilities so far, and I've now trained my neural network to output a probability for each pair of unique objects, in addition to

Sampling without replacement with unequal, dependent probabilities

℡╲_俬逩灬. 提交于 2020-08-05 09:37:07
问题 So from answers to the question, Randomly Generating Combinations From Variable Weights, I've managed to sample without replacement given unequal probabilities. I've implemented this in my particular context and it works great. Now I have access to additional information about my distribution. Specifically, I've been using a neural network to generate these probabilities so far, and I've now trained my neural network to output a probability for each pair of unique objects, in addition to

Python: How to get the convolution of two continuous distributions?

落爺英雄遲暮 提交于 2020-07-05 11:18:27
问题 Let X, Y be 2 random variables, with probability density functions pdf1 and pdf2. Z = X + Y Then the probability density function of Z is given by the convolution of pdf1 and pdf2. Since we can't deal with continuous distributions, we descritize the continuous distributions and deal with them. To find the convolution of uniform distribution and normal distribution, I came up with following code. import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats from scipy import

Implementing specific distribution in python

余生长醉 提交于 2020-06-27 11:19:14
问题 i want to return 1<l<10 with probability 1/(2^(l-1)) how i should do this rather then: x = random() if x < 0.5: return 2 and so on thank you 回答1: This is going to be fun... I am a bit rusty with these things, so a good matematician could fix my reasoning. To generate a distribution from a formula you need first to do some integrals and calculate the cumulative density function for the specified interval. In particular we need to start to calculate the normalization constant. This integral

Implementing specific distribution in python

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-27 11:17:58
问题 i want to return 1<l<10 with probability 1/(2^(l-1)) how i should do this rather then: x = random() if x < 0.5: return 2 and so on thank you 回答1: This is going to be fun... I am a bit rusty with these things, so a good matematician could fix my reasoning. To generate a distribution from a formula you need first to do some integrals and calculate the cumulative density function for the specified interval. In particular we need to start to calculate the normalization constant. This integral

Simulating data in R with multiple probability distributions

一世执手 提交于 2020-06-26 05:33:15
问题 I am trying to simulate data via bootstrapping to create confidence bands for my real data with a funnel plot. I am building on the strategy of the accepted answer to a previous question. Instead of using a single probability distribution for simulating my data I want to modify it to use different probability distributions depending on the part of the data being simulated. I greatly appreciate anyone who can help answer the question or help me phrase the question more clearly. My problem is

python itertools product repeat to big

烂漫一生 提交于 2020-06-23 13:26:47
问题 I'm trying to make a python script to calculate some win/loss chances. to do this i'm trying to get all possible combinations off wins and losses (K is the number of wins needed to win the game): for combination in itertools.product(['W','L'], repeat=(K*2)-1): if ((combination.count('L') < K) and (combination.count('W') == K)): #calculate the chance of this situation happening for some reason this works fine, until the repeat becomes to big (for instance if K=25) Can someone give me some

python itertools product repeat to big

本秂侑毒 提交于 2020-06-23 13:26:10
问题 I'm trying to make a python script to calculate some win/loss chances. to do this i'm trying to get all possible combinations off wins and losses (K is the number of wins needed to win the game): for combination in itertools.product(['W','L'], repeat=(K*2)-1): if ((combination.count('L') < K) and (combination.count('W') == K)): #calculate the chance of this situation happening for some reason this works fine, until the repeat becomes to big (for instance if K=25) Can someone give me some

Calculating probability for FUNPROB

依然范特西╮ 提交于 2020-06-16 17:14:40
问题 Regarding - FUNPROB The solution is : int N, M; while(1) { scanf("%d %d", &N, &M); if (0 == N && 0 == M) break; if (N > M) printf("0.000000\n"); else { double res = (double) (M-N+1) / (M+1); printf("%.6f\n", res); } } My question is regarding line res = (M-N+1) / (M+1); How to arrive at the conclusion that the probability is calculated in this way ? 回答1: At first it is obvious that if N>M probability is zero. now I want to use indication on N to prove. consider M>0 I want to prove for every N