gaussian

Why use log-probability estimates in GaussianNB [scikit-learn]?

南笙酒味 提交于 2020-01-03 07:11:06
问题 I'm currently using scikit-learn's GaussianNB package. I've noticed that I can choose to return results for the classification several different ways. One way to return a classification is using the predict_log_proba method. Why would I choose to use predict_log_proba versus predict_proba versus predict? 回答1: predict just gives you the class for every example predict_proba gives you the probability for every class, and predict is just taking the class which maximal probability predict_log

Fitting partial Gaussian

杀马特。学长 韩版系。学妹 提交于 2020-01-02 02:35:10
问题 I'm trying to fit a sum of gaussians using scikit-learn because the scikit-learn GaussianMixture seems much more robust than using curve_fit. Problem : It doesn't do a great job in fitting a truncated part of even a single gaussian peak: from sklearn import mixture import matplotlib.pyplot import matplotlib.mlab import numpy as np clf = mixture.GaussianMixture(n_components=1, covariance_type='full') data = np.random.randn(10000) data = [[x] for x in data] clf.fit(data) data = [item for

SVG gaussian blur in Safari unexpectedly lightens image

一笑奈何 提交于 2020-01-01 16:32:22
问题 Using svg guassian blur filter to perform cross browser image blurring. Overall, it works really well except in the case of Safari. In desktop Safari, the image is blurred but it is also lightened. This doesn't happen in any other browser (literally tested in Firefox, Chrome, IE9-11, and mobile Safari in iOS 7). Here's a jsfiddle demonstrating the live svg filter and a linked screenshot from what Safari is seeing, http://jsfiddle.net/vtDYg/3/ Here also is the svg code current in use: <svg

iOS Gaussian distribution of random numbers [duplicate]

大城市里の小女人 提交于 2020-01-01 11:56:27
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Generating a random Gaussian double in Objective-C/C Is there any way of getting a random number not from a uniform distribution, but from a Gaussian (Normal, Bell Curve) distribution in iOS? All the random number generators I have found are basically uniform and I want to make the numbers cluster around a certain point. Thanks! 回答1: Just use a uniform distribution generator and apply the Box-Muller Transform:

when generating normally-distributed random values, what is the most efficient way to define the range?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 00:43:11
问题 FYI: random == pseudo-random A. when generating uniformly-random numbers, I can specify a range, i.e.: (Math.random()-Math.random())*10+5 //generates numbers between -5 and 15 B. generating a set of random values with a version of Gaussian-esque normal randomness: //pass in the mean and standard deviation function randomNorm(mean, stdev) { return Math.round((Math.random()*2-1)+(Math.random()*2-1)+(Math.random()*2-1))*stdev+mean); } //using the following values: { mean:400, standard_deviation

2d probability distribution with rbf and scipy

随声附和 提交于 2019-12-31 04:02:16
问题 I have something similar to this problem respectivly the answer of this problem: RBF interpolation: LinAlgError: singular matrix But I want to do the probability distribution with rbf. My code until now: from scipy.interpolate.rbf import Rbf # radial basis functions import cv2 import matplotlib.pyplot as plt import numpy as np x = [1, 1, 2 ,3, 4, 4, 2, 6, 7] y = [0, 2, 5, 6, 2, 4, 1, 5, 2] rbf_adj = Rbf(x, y, function='gaussian') plt.figure() # Plotting the original points. plot3 = plt.plot(x

Eclipse gives error when using GaussianBlur with OpenCV for Android

[亡魂溺海] 提交于 2019-12-30 18:28:24
问题 I posted a little part of my code, cause i keep getting a strange error that I can't seem to get rid of. The problem can be found on this line: Imgproc.GaussianBlur(mGray, mGray, new Size (5,5), 2.2, 2); public Mat onCameraFrame(Mat inputFrame) { mGray = new Mat(); Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGBA2GRAY); // doing a gaussian blur prevents getting a lot of false hits Imgproc.GaussianBlur(mGray, mGray, new Size (5,5), 2.2, 2); // Values 3 and 4are the LowerThreshold and

Python - Kriging (Gaussian Process) in scikit_learn

别等时光非礼了梦想. 提交于 2019-12-30 06:20:50
问题 I am considering using this method to interpolate some 3D points I have. As an input I have atmospheric concentrations of a gas at various elevations over an area. The data I have appears as values every few feet of vertical elevation for several tens of feet, but horizontally separated by many hundreds of feet (so 'columns' of tightly packed values). The assumption is that values vary in the vertical direction significantly more than in the horizontal direction at any given point in time. I

OpenCV: color extraction based on Gaussian mixture model

橙三吉。 提交于 2019-12-29 11:41:20
问题 I am trying to use opencv EM algorithm to do color extraction.I am using the following code based on example in opencv documentation: cv::Mat capturedFrame ( height, width, CV_8UC3 ); int i, j; int nsamples = 1000; cv::Mat samples ( nsamples, 2, CV_32FC1 ); cv::Mat labels; cv::Mat img = cv::Mat::zeros ( height, height, CV_8UC3 ); img = capturedFrame; cv::Mat sample ( 1, 2, CV_32FC1 ); CvEM em_model; CvEMParams params; samples = samples.reshape ( 2, 0 ); for ( i = 0; i < N; i++ ) { //from the

Python: two-curve gaussian fitting with non-linear least-squares

旧城冷巷雨未停 提交于 2019-12-29 03:05:08
问题 My knowledge of maths is limited which is why I am probably stuck. I have a spectra to which I am trying to fit two Gaussian peaks. I can fit to the largest peak, but I cannot fit to the smallest peak. I understand that I need to sum the Gaussian function for the two peaks but I do not know where I have gone wrong. An image of my current output is shown: The blue line is my data and the green line is my current fit. There is a shoulder to the left of the main peak in my data which I am