gaussian

Equivalent of Matlab's 'fit' for Gaussian mixture models in R?

主宰稳场 提交于 2019-12-25 12:44:34
问题 I have some time series data that looks like this: x <- c(0.5833, 0.95041, 1.722, 3.1928, 3.941, 5.1202, 6.2125, 5.8828, 4.3406, 5.1353, 3.8468, 4.233, 5.8468, 6.1872, 6.1245, 7.6262, 8.6887, 7.7549, 6.9805, 4.3217, 3.0347, 2.4026, 1.9317, 1.7305, 1.665, 1.5655, 1.3758, 1.5472, 1.7839, 1.951, 1.864, 1.6638, 1.5624, 1.4922, 0.9406, 0.84512, 0.48423, 0.3919, 0.30773, 0.29264, 0.19015, 0.13312, 0.25226, 0.29403, 0.23901, 0.000213074755156413, 5.96565965097398e-05, 0.086874, 0.000926808687858284,

OpenCV: how to categorize GMM calculated probs

喜欢而已 提交于 2019-12-25 05:23:10
问题 I am using opencv EM algorithm to obtain GMM models with the help of example code in opencv documentation as follows: cv::Mat capturedFrame const int N = 5; int nsamples = 100; cv::Mat samples ( nsamples, 2, CV_32FC1 ); samples = samples.reshape ( 2, 0 ); cv::Mat sample ( 1, 2, CV_32FC1 ); CvEM em_model; CvEMParams params; for ( i = 0; i < N; i++ ) { //from the training samples cv::Mat samples_part = samples.rowRange ( i*nsamples/N, (i+1)*nsamples/N); cv::Scalar mean (((i%N)+1)*img.rows/(N1+1

How to fit gaussian with Matlab with given height

时间秒杀一切 提交于 2019-12-25 04:53:09
问题 I am currently unable to have accurate gaussian fit. How can I fix the height? (see picture). ft=fit(x,y,'gauss2') Co=coeffvalues(ft) sigma=Co(3)/sqrt(2) mu = Co(2) C=Co(1) plot(X,C*exp(-(X - mu).^2 / (2*sigma^2))+min(y), '-r') 回答1: You can try lsqcurvefit to do single or multiple Gaussian fitting accurately. x = lsqcurvefit(fun,x0,xdata,ydata) fun is your Gaussian function, x0 holds the initial value of the Gaussian parameters (mu, sigma, height, etc). fun(x0) return the gaussian in vector

Log likelihood function for GDA(Gaussian Discriminative analysis)

浪子不回头ぞ 提交于 2019-12-25 04:29:09
问题 I am having trouble understanding the likelihood function for GDA given in Andrew Ng's CS229 notes. l(φ,µ0,µ1,Σ) = log (product from i to m) {p(x(i)|y(i);µ0,µ1,Σ)p(y(i);φ)} The link is http://cs229.stanford.edu/notes/cs229-notes2.pdf Page 5. For Linear regression the function was product from i to m p(y(i)|x(i);theta) which made sense to me. Why is there a change here saying it is given by p(x(i)|y(i) and that is multiplied by p(y(i);phi)? Thanks in advance 回答1: The starting formula on page 5

Scipy MLE fit of a normal distribution

徘徊边缘 提交于 2019-12-25 01:46:18
问题 I was trying to adopt this solution proposed in this thread to determine the parameters of a simple normal distribution. Even though the modifications are minor (based on wikipedia), the result is pretty off. Any suggestion where it goes wrong? import math import numpy as np from scipy.optimize import minimize import matplotlib.pyplot as plt def gaussian(x, mu, sig): return 1./(math.sqrt(2.*math.pi)*sig)*np.exp(-np.power((x - mu)/sig, 2.)/2) def lik(parameters): mu = parameters[0] sigma =

How to plot a Gaussian function on Python?

浪尽此生 提交于 2019-12-24 22:57:36
问题 I have a datafile like this Frequencies -- 95.1444 208.5295 256.0966 IR Inten -- 4.5950 0.1425 2.4807 Frequencies -- 273.7203 424.4748 446.9433 IR Inten -- 0.6420 0.0001 0.9654 Frequencies -- 520.5846 561.6770 630.1851 IR Inten -- 8.8996 6.4944 0.4674 Frequencies -- 703.7315 767.1711 799.2923 IR Inten -- 23.7514 63.4507 15.9273 Each frequency is related with the IR intensity below, for example (frequency= 95.1444/ IR Inten= 4.5950), (frequency= 208,5295/ IR Inten= 0.1425).... And so on. I

How does the stats.gaussian_kde method calcute the pdf?

人走茶凉 提交于 2019-12-24 17:55:57
问题 I am using the scipy.stats.gaussian_kde method from scipy to generate random samples from the data. It works fine! What I have now found out is that the method also has inbuilt functions to calculate the probability density function of the given set of points (my data). I would like to know how it calculates the pdf provided a set of points. Here is small example: import numpy as np import scipy.stats from scipy import stats def getDistribution1(data): kernel = stats.gaussian_kde(data,bw

How to get the gaussian blur effect on a UIView in iOS6

纵然是瞬间 提交于 2019-12-24 08:59:41
问题 Does anyone know how to achieve a gaussian blur effect on an UIView in iOS6? Similar to twitter's #music app when the filter menu is open. (the background under the menu becomes blurred) 回答1: I wrote a library RWBlurPopover based on GPUImage that can achieve similar gaussian blur effect when presenting a popover. Supports both iPhone and iPad, and runs on iOS 5.1+. 来源: https://stackoverflow.com/questions/16182788/how-to-get-the-gaussian-blur-effect-on-a-uiview-in-ios6

Image deblurring using gaussian filter in matlab without additive noise

允我心安 提交于 2019-12-24 08:26:20
问题 I have to use an inverse filter to remove the blurring from this image . Unfortunately, I have to figure out the transfer function H of the imaging system used to get these sharper images, It should be Gaussian. So, I should determine the approximate width of the Gaussian by trying different Gaussian widths in an inverse filter and judging which resulting images look the “best”. The best result will be optimally sharp – i.e., edges will look sharp but will not have visible ringing. I tried by

Tensorflow 2D convolution on RGB channels separately?

半世苍凉 提交于 2019-12-24 04:24:10
问题 I want to apply a Gaussian blur to an RGB image. I want it to be operated on each channel independently. The code below outputs a blurred image with 3 channels but all with the same value, resulting in a grey image . gauss_kernel_2d = gaussian_kernel(2, 0.0, 1.0) # outputs a 5*5 tensor gauss_kernel = tf.tile(gauss_kernel_2d[:, :, tf.newaxis, tf.newaxis], [1, 1, 3, 3]) # 5*5*3*3 image = tf.nn.conv2d(tf.expand_dims(image, 0), gauss_kernel, strides=[1, 1, 1, 1], padding='SAME') # 1*600*800*3