Questions tagged [gaussian]

For issues related to any of the uses of the Gaussian function. Don't forget to add additional tags to clarify the context.

The graph of a Gaussian is a characteristic symmetric "bell curve" shape that quickly falls off towards plus/minus infinity. The 1-D Gaussian is defined as (taken from wikipedia):

gaussian function from wikipedia

The parameter a is the height of the curve's peak, b is the position of the centre of the peak, and c controls the width of the "bell".

In multiple dimensions, the Gaussian is defined as the product of 1D curves along each dimension.

Gaussian functions are widely used in statistics where they describe the normal distributions, in signal processing where they serve to define Gaussian filters, in image processing where two-dimensional Gaussians are used for Gaussian blurs, in mathematics and physics where they are used to solve heat equations and diffusion equations, to formulate the propagation of optical beams (Gaussian beams), to from a basis set of wavefunctions, to define the Weierstrass transform, and many more.

1812 questions
5
votes
2 answers

Numpy array with different standard deviation per row

I'd like to get an NxM matrix where numbers in each row are random samples generated from different normal distributions(same mean but different standard deviations). The following code works: import numpy as np mean = 0.0 # same mean stds = [1.0,…
5
votes
1 answer

Gaussian data fit varying depending on position of x data

I am having a hard time trying to understand why my Gaussian fit to a set of data (ydata) does not work well if I shift the interval of x-values corresponding to that data (xdata1 to xdata2). The Gaussian is written as: where A is just an…
andrerud
  • 146
  • 1
  • 11
5
votes
2 answers

What's wrong with this python image blur function?

EDIT: Thanks to Howard, I've corrected the code here and it seems to be working now. EDIT2: I've updated the code to include a vertical blur as originally intended. Resulting sample output with various settings: Blur comparison images.jpg Another…
moski
  • 279
  • 1
  • 4
  • 10
5
votes
1 answer

generate anisotropic data in sklearn

In sklearn documentation, they provide code to convert a blob of normally distributed data to anisotripically distributed data as shown below transformation = [[0.60834549, -0.63667341], [-0.40887718, 0.85253229]] X_aniso = np.dot(X,…
Shew
  • 1,557
  • 1
  • 21
  • 36
5
votes
3 answers

Sort array of numbers by normal distribution (gaussian distribution)

Having an array of numbers setOfNumbers = [0, 3, 3, 2, 7, 1, -2, 9] I'd like to sort this set to have the smallest numbers on the end and beginning and the biggest in the center of the sorted set like this sortedSetNumbers = [0, 2, 3, 9, 7, 3, 1,…
Michael W. Czechowski
  • 3,366
  • 2
  • 23
  • 50
5
votes
1 answer

Sklearn GaussianProcessRegressor fixing kernel hyperparameters?

I'm trying to use sklearn's gaussian process for timeseries decomposition. kernel = ConstantKernel() * RBF() * ExpSineSquared(periodicity=7) Is there a way to fix the parameters other then periodicity_bounds=(7, 7) If i do kernel.hyperparameters i…
CodeMonkey
  • 3,418
  • 4
  • 30
  • 53
5
votes
3 answers

Problem with scipy.optimize.fmin_slsqp when using very large or very small numbers

Has anybody ever encountered problems with fmin_slsqp (or anything else in scipy.optimize) only when using very large or very small numbers? I am working on some python code to take a grayscale image and a mask, generate a histogram, then fit…
user620538
  • 51
  • 1
  • 3
5
votes
2 answers

Why is it scipy.stats.gaussian_kde() slower than seaborn.kde_plot() for the same data?

In python 3.7, I have this numpy array with shape=(2, 34900). This arrays is a list of coordinates where the index 0 represents the X axis and the index 1 represents the y axis. When I use seaborn.kde_plot() to make a visualization of the…
Victor
  • 319
  • 2
  • 10
5
votes
0 answers

How to achieve a gaussian blur with React Native?

I know there are some packages that let you create a blur view, but they all have sharp edges. There is also a blurRadius prop for the Image component, but it also renders an image with sharp edges. How can I achieve a blurred image without sharp…
5
votes
2 answers

fit (triple-) gauss to data python

The short version of my problem is the following: I have a histogram of some data (density of planets) which seems to have 3 peeks. Now I want to fit 3 gaussians to this histogram. I am expecting this outcome. I used different methods to fit my…
Carina
  • 217
  • 4
  • 11
5
votes
1 answer

Define skewed gaussian function that returns two parameters after fitting

I know such questions have been asked a few times already, but still I can't get it: I want to define a function that returns more than one parameter. I have written the following code to fit data to a skewed gaussian function: def skew(x, sigmag,…
Py-ser
  • 1,860
  • 9
  • 32
  • 58
5
votes
3 answers

Gaussian fit returning negative sigma

One of my algorithms performs automatic peak detection based on a Gaussian function, and then later determines the the edges based either on a multiplier (user setting) of the sigma or the 'full width at half maximum'. In the scenario where a user…
Bas Jansen
  • 3,273
  • 5
  • 30
  • 66
5
votes
2 answers

how do you generate random numbers from a bimodal Gaussian Probability Density Function in MATLAB?

How do you generate numbers from a bimodal Gaussian PDF in MATLAB? For a unimodal symmetric Gaussian PDF it is really easy: x=randn(1000,1); But now I want to draw 1000 numbers from a Gaussian PDF that has two peaks (or two means). How do I do…
user1068636
  • 1,871
  • 7
  • 33
  • 57
5
votes
2 answers

Using python to generate clusters of data?

I'm working on a Python function, where I want to model a Gaussian distribution, I'm stuck though. import numpy.random as rnd import numpy as np def genData(co1, co2, M): X = rnd.randn(2, 2M + 1) t = rnd.randn(1, 2M + 1) numpy.concatenate(X,…
Andrew Raleigh
  • 311
  • 3
  • 13
5
votes
2 answers

In Matlab, How to divide multivariate Gaussian distributions to separate Gaussians?

I have an image with multivariate Gaussian distribution in histogram. I want to segment the image to two regions so that they both can follow the normal distribution like the red and blue curves shows in histogram. I know Gaussian mixture model…
SimaGuanxing
  • 673
  • 2
  • 10
  • 29