sigma

Getting standard errors on fitted parameters using the optimize.leastsq method in python

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a set of data (displacement vs time) which I have fitted to a couple of equations using the optimize.leastsq method. I am now looking to get error values on the fitted parameters. Looking through the documentation the matrix outputted is the jacobian matrix, and I must multiply this by the residual matrix to get my values. Unfortunately I am not a statistician so I am drowning somewhat in the terminology. From what I understand all I need is the covariance matrix that goes with my fitted parameters, so I can square root the diagonal

Fitting lognormal distribution using Scipy vs Matlab

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to fit a lognormal distribution using Scipy. I've already done it using Matlab before but because of the need to extend the application beyond statistical analysis, I am in the process of trying to reproduce the fitted values in Scipy. Below is the Matlab code I used to fit my data: % Read input data (one value per line) x = []; fid = fopen(file_path, 'r'); % reading is default action for fopen disp('Reading network degree data...'); if fid == -1 disp('[ERROR] Unable to open data file.') else while ~feof(fid) [x] = [x fscanf(fid,

Multivariate kernel density estimation in Python

匿名 (未验证) 提交于 2019-12-03 01:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 = np.array([1, 10, 20]) sigma = np.matrix([[4, 10, 0], [10, 25, 0], [0, 0, 100]]) data = np.random.multivariate_normal(mu, sigma, 1000) values = data.T kernel = stats.gaussian_kde(values) I saw this but not sure how to extend it to 3D. Also not sure how do I even begin to evaluate the

How to implement ZCA Whitening? Python

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Im trying to implement ZCA whitening and found some articles to do it, but they are a bit confusing.. can someone shine a light for me? Any tip or help is appreciated! Here is the articles i read : http://courses.media.mit.edu/2010fall/mas622j/whiten.pdf http://bbabenko.tumblr.com/post/86756017649/learning-low-level-vision-feautres-in-10-lines-of I tried several things but most of them i didnt understand and i got locked at some step. Right now i have this as base to start again : dtype = np . float32 data = np . loadtxt ( "..

LSA - Latent Semantic Analysis - How to code it in PHP?

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to implement Latent Semantic Analysis (LSA) in PHP in order to find out topics/tags for texts. Here is what I think I have to do. Is this correct? How can I code it in PHP? How do I determine which words to chose? I don't want to use any external libraries. I've already an implementation for the Singular Value Decomposition (SVD) . Extract all words from the given text. Weight the words/phrases, e.g. with . If weighting is too complex, just take the number of occurrences. Build up a matrix: The columns are some documents from

How to calculate cumulative normal distribution in Python

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am looking for a function in Numpy or Scipy (or any rigorous Python library) that will give me the cumulative normal distribution function in Python. 回答1: Here's an example: >>> from scipy.stats import norm >>> norm.cdf(1.96) array(0.97500210485177952) If you need the inverse CDF: >>> norm.ppf(norm.cdf(1.96)) array(1.9599999999999991) 回答2: It may be too late to answer the question but since Google still leads people here, I decide to write my solution here. That is, since Python 2.7, the math library has integrated the error function math

Python: Resize an existing array and fill with zeros

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I think that my issue should be really simple, yet I can not find any help on the Internet whatsoever. I am very new to Python, so it is possible that I am missing something very obvious. I have an array, S, like this [x x x] (one-dimensional) . I now create a diagonal matrix, sigma , with np.diag(S) - so far, so good. Now, I want to resize this new diagonal array so that I can multiply it by another array that I have. import numpy as np ... shape = np . shape (( 6 , 6 )) #This will be some pre-determined size sigma = np . diag ( S

No space left while using Multiprocessing.Array in shared memory

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am using the multiprocessing functions of Python to run my code parallel on a machine with roughly 500GB of RAM. To share some arrays between the different workers I am creating a Array object: N = 150 ndata = 10000 sigma = 3 ddim = 3 shared_data_base = multiprocessing . Array ( ctypes . c_double , ndata * N * N * ddim * sigma * sigma ) shared_data = np . ctypeslib . as_array ( shared_data_base . get_obj ()) shared_data = shared_data . reshape (- 1 , N , N , ddim * sigma * sigma ) This is working perfectly for sigma=1 , but for

How to calculate a Gaussian kernel matrix efficiently in numpy?

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: def GaussianMatrix(X,sigma): row,col=X.shape GassMatrix=np.zeros(shape=(row,row)) X=np.asarray(X) i=0 for v_i in X: j=0 for v_j in X: GassMatrix[i,j]=Gaussian(v_i.T,v_j.T,sigma) j+=1 i+=1 return GassMatrix def Gaussian(x,z,sigma): return np.exp((-(np.linalg.norm(x-z)**2))/(2*sigma**2)) This is my current way. Is there any way I can use matrix operation to do this? X is the data points. 回答1: Do you want to use the Gaussian kernel for e.g. image smoothing? If so, there's a function gaussian_filter() in scipy: Alternatively, this should work:

By which measures should I set the size of my Gaussian filter in MATLAB?

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to learn image processing using MATLAB and I have read about filters on images. By considering this code: gaussianFilter = fspecial ( 'gaussian' , [ 7 , 7 ], 5 ) , this builds a Gaussian filter matrix of 7 rows and 7 columns, with standard deviation of 5. As such, the size of filter matrix is 7 x 7 . How can the size of this matrix be effective on filtering? (What does this matrix do ?) By which measures should I set the size of filter matrix in my code? 回答1: One of the most common and heuristic measures on determining