Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fit gaussians (or other distributions) on my data using python

I have a database of features, a 2D np.array (2000 samples and each sample contains 100 features, 2000 X 100). I want to fit gaussian distributions to my database using python. My code is the following:

data = load_my_data() # loads a np.array with size 2000x200
clf = mixture.GaussianMixture(n_components= 50, covariance_type='full')
clf.fit(data)

I am not sure about the parameters for example the covariance_type and how can I investigate whether the fit was occured succesfully or not.

EDIT: I debug the code to investigate what is happening with the clf.means_ and appartently it produced a matrix n_components X size_of_features 50 X 20). Is there a way that i can check that the fitting was successful, or to plot data? What are the alternatives to Gaussian mixtures (mixtures of exponential for example, I cannot find any available implementation)?

like image 851
Jose Ramon Avatar asked Nov 30 '25 05:11

Jose Ramon


1 Answers

I think you are using sklearn package.

Once you have fit, then type

print clf.means_

If it has output, then the data is fitted, if it raise errors, not fitted.

Hope this helps you.

like image 155
chenxingwei Avatar answered Dec 02 '25 18:12

chenxingwei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!