Martim Correia
Martim Correia

Reputation: 505

sketching a Gaussian Mixture plot

So basically I have these points and weights and covariance matrices and 1st mean=x1 and 2nd mean=x2.

Data values

What I am trying to do is to plot the clusters of that Gaussian distribution with ellipses around the clusters, but for some reason I think the parameters I am using in my program are wrong.

Program:

from sklearn.mixture import GaussianMixture
import pandas as pd
import numpy as np

X = np.array([[2, 4], [-1, -4], [-1, 2], [4, 0]])

inv_cov1= [[1,0],[0,1]]
inv_cov2= [[0.5,0],[0,0.5]]

weights = np.array([0.7,0.3])

means = np.array([[2, 4], [-1, -4]])

Covs = np.array(inv_cov1,inv_cov2)
gm = GaussianMixture(n_components=2, random_state=0,reg_covar=0,weights_init=weights,means_init=means,precisions_init=Covs).fit(X)

I don't understand whats wrong with my program.

Upvotes: 2

Views: 329

Answers (0)

Related Questions