mixture-model

R: unexpected behavior of the fdwm() function (evmix package)

青春壹個敷衍的年華 提交于 2020-01-25 20:40:53
问题 I am trying to fit a dynamic mixture model (Weibull for the bulk, Pareto for the tail) using the fdwm() function from the evmix package: library(repmis) library(evmix) data=source_data("https://www.dropbox.com/s/r7i0ctl1czy481d/test.csv?dl=0")[,1] test=fdwm(data,c(0.9150062,75.4699181,quantile(data,0.98),11.21,87.41,0.05)) I am experiencing a weird behavior: the function first returns an error...: Error in integrate(rx, wshape, wscale, cmu = cmu, ctau = ctau, sigmau = sigmau, : non-finite

Keras Model using Tensorflow Distribution for loss fails with batch size > 1

那年仲夏 提交于 2020-01-24 12:16:57
问题 I'm trying to use a distribution from tensorflow_probability to define a custom loss function in Keras. More specifically, I'm trying to build a Mixture Density Network. My model works on a toy dataset when batch_size = 1 (it learns to predict the correct mixture distribution for y using x ). But it "fails" when batch_size > 1 (it predicts the same distribution for all y , ignoring x ). This makes me think my problem has to do with batch_shape vs. sample_shape. To reproduce: import random

Keras Model using Tensorflow Distribution for loss fails with batch size > 1

怎甘沉沦 提交于 2020-01-24 12:16:06
问题 I'm trying to use a distribution from tensorflow_probability to define a custom loss function in Keras. More specifically, I'm trying to build a Mixture Density Network. My model works on a toy dataset when batch_size = 1 (it learns to predict the correct mixture distribution for y using x ). But it "fails" when batch_size > 1 (it predicts the same distribution for all y , ignoring x ). This makes me think my problem has to do with batch_shape vs. sample_shape. To reproduce: import random

How to construct and plot uni-variate Gaussian Mixture using its parameters in Python

本秂侑毒 提交于 2020-01-06 18:45:40
问题 I want to construct and 1D plot a uni-variate Gaussian Mixture with say three components in Python where I already have its parameters including mu,sigma,mix coefficients. What I am after has an equivalent in MATLAB i.e. gmdistribution(mu,sigma,p) I think the code should look sth like this: from numpy import * from matplotlib.pylab import * from sklearn import mixture gmm = mixture.GMM(n_components=3) gmm.means_ = np.array([[-1], [0], [3]]) gmm.covars_ = np.array([[1.5], [1], [0.5]]) ** 2 gmm

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,

Effect of feature scaling on accuracy

耗尽温柔 提交于 2019-12-20 10:44:19
问题 I am working on image classification using Gaussian Mixture Models. I have around 34,000 features, belonging to three classes, all lying in a 23 dimensional space. I performed feature scaling on both the training and testing data using different methods, and I observed that accuracy actually reduces after performing scaling . I performed feature scaling because there was a difference of many orders between many features. I am curious to know why this is happening, I thought that feature

Gaussian Mixture Model in MATLAB - Calculation of the Empirical Variance Covariance Matrix

爱⌒轻易说出口 提交于 2019-12-14 04:04:56
问题 I am having issues in reconciling some basic theoretical results on Gaussian mixtures and the output of the commands gmdistribution, random in Matlab. Consider a mixture of two independent 3-variate normal distributions with weights 1/2,1/2 . The first distribution A is characterised by mean and variance-covariance matrix equal to muA=[-1.4 3.2 -1.9]; %mean vector rhoA=-0.5; %correlation among components in A sigmaA=[1 rhoA rhoA; rhoA 1 rhoA; rhoA rhoA 1]; %variance-covariance matrix of A The

Python - Statistical distribution

霸气de小男生 提交于 2019-12-14 03:35:32
问题 I'm quite new to python world. Also, I'm not a statistician. I'm in the need to implementing mathematical models developed by mathematicians in a computer science programming language. I've chosen python after some research. I'm comfortable with programming as such (PHP/HTML/javascript). I have a column of values that I've extracted from a MySQL database & in need to calculate the below - 1) Normal distribution of it. (I don't have the sigma & mu values. These need to be calculated too

'None' gradients in pytorch

此生再无相见时 提交于 2019-12-13 03:45:39
问题 I am trying to implement a simple MDN that predicts the parameters of a distribution over a target variable instead of a point value, and then assigns probabilities to discrete bins of the point value. Narrowing down the issue, the code from which the 'None' springs is: import torch # params tte_bins = np.linspace( start=0, stop=399, num=400, dtype='float32' ).reshape(1, 1, -1) bins = torch.tensor(tte_bins, dtype=torch.float32) x_train = np.random.randn(1, 1024, 3) y_labels = np.random

Sklearn-GMM on large datasets

老子叫甜甜 提交于 2019-12-11 02:48:33
问题 I have a large data-set (I can't fit entire data on memory). I want to fit a GMM on this data set. Can I use GMM.fit() ( sklearn.mixture.GMM ) repeatedly on mini batch of data ?? 回答1: There is no reason to fit it repeatedly. Just randomly sample as many data points as you think your machine can compute in a reasonable time. If variation is not very high, the random sample will have approximately the same distribution as the full dataset. randomly_sampled = np.random.choice(full_dataset, size