gaussian

Multiple gaussian fit issue

Multiple gaussian fit issue Question: I have this code that aims to fit the data in here https://drive.google.com/file/d/1uBrHxuftALiQTcTeBl-s6AHGiC8DGBWV/view?usp=sharing. Where the function read_file is used to stract the information in a proper way. I do not what i am doing wrong that the gaussian fit is not right as you can see in the image (Gaussian …

Total answers: 1

How to implement a 2D Gaussian on a 2D numpy array

How to implement a 2D Gaussian on a 2D numpy array Question: I have a 2D NumPy array of size 10 by 10, in which I am trying to implement a 2D Gaussian distribution on it so that I can use the new column as a feature in my ML model. The center (the peak …

Total answers: 2

Creating 2-D Gaussian Distributions With Python

Creating 2-D Gaussian Distributions With Python Question: I’m trying to create 2-D Gaussian distributions based off the question in the image below. I’m using numpy’s multivariate_normal(): mu1 = [2,0] cov1 = [[1,0],[0,1]] gauss1 = np.random.multivariate_normal(mu1, cov1, 1000) print(gauss1[:5]) [[ 2.31429248 -0.66406452] [ 0.26891266 -0.6157051 ] [ 1.93124527 -1.33371758] [ 3.55936363 0.84616475] [ 2.70321679 -1.43942645]] Is …

Total answers: 1

How do I get to show Gaussian Kernel for 2d? (opencv)

How do I get to show Gaussian Kernel for 2d? (opencv) Question: I am using this: blur = cv2.GaussianBlur(dst,(5,5),0) And I wanted to show the kernel matrix by this: print(cv2.getGaussianKernel(ksize=(5,5),sigma=0)) But I am getting a type error: TypeError: an integer is required (got type tuple) If I only put 5, I get a 5×1 matrix. …

Total answers: 3

How to create Gaussian Noise texture in python?

How to create Gaussian Noise texture in python? Question: I need to create a texture like the below one with the specific key is there any way of creating this using python? Also, I need to extract the texture from another image and compare using this.Basically, the idea is, I will create a texture using …

Total answers: 1

ValueError: bad input shape (1, 4) in sklearn.naive_bayes.GaussianNB

ValueError: bad input shape (1, 4) in sklearn.naive_bayes.GaussianNB Question: I started to learn machine learning, currently Naive Bayes/ My python script import numpy as np x = np.array([[0,0],[1,1],[0,1],[1,0]]) y = np.array([0,0,1,1]) print(x) from sklearn.naive_bayes import GaussianNB clf = GaussianNB() x = x.reshape(1,-1) y = y.reshape(1,-1) clf.fit(x,y) a = clf.predict([[1,1]]) print(a) Error The error is: [[0 …

Total answers: 1

How to fit a double Gaussian distribution in Python?

How to fit a double Gaussian distribution in Python? Question: I am trying to obtain a double Gaussian distribution for data (link) using Python. The raw data is of the form: For the given data, I would like to obtain two Gaussian profiles for the peaks seen in figure. I tried it with the following …

Total answers: 2

What is the difference between random.normalvariate() and random.gauss() in python?

What is the difference between random.normalvariate() and random.gauss() in python? Question: What is the difference between random.normalvariate() and random.gauss()? They take the same parameters and return the same value, performing essentially the same function. I understand from a previous answer that random.gauss() is not thread safe, but what does this mean in this context? Why …

Total answers: 4

Multivariate kernel density estimation in Python

Multivariate kernel density estimation in Python Question: I am trying to use SciPy’s gaussian_kde function to estimate the density of multivariate data. In my code below I sample a 3D multivariate normal and fit the kernel density but I’m not sure how to evaluate my fit. import numpy as np from scipy import stats mu …

Total answers: 2

Gaussian fit for Python

Gaussian fit for Python Question: I’m trying to fit a Gaussian for my data (which is already a rough gaussian). I’ve already taken the advice of those here and tried curve_fit and leastsq but I think that I’m missing something more fundamental (in that I have no idea how to use the command). Here’s a …

Total answers: 7