emclust py import numpy as np from scipy stats import multivariate_normal xmat np genfromtxt ('clusterdata csv 'delimiter =',' nd xmat shape np array ([[ / , / , / ]] np array ([- - , ,- , - ]dtype =np float note that if above *allentries were written as integers would be defined to be of integer type which will give the wrong answer np zeros (( , , ) [, , [, , np zeros (( , )for in range ( , )# -step for in range ( , )mvn multivariate_normal [:,ktc[ ,,: [ ,: [ , ]mvn pdf(xmatm-step ( /sum( , )normalize np mean( , reshape ( , for in range ( , ) [:, (xmat [ ,: )/sum( [ ,:]xm xmat [:,kreshape ( , [ ,,:xm (xm* [ ,:] /sum( [ ,:]the estimated parameters of the mixture distribution are given on the right-hand side of figure after relabeling of the clusterswe can observe close match with the parameters in figure the ellipses on the left-hand side of figure show close match between the probability ellipses of the original gaussian distributions (in grayand the estimated ones natural way to cluster each point xi is to assign it to the cluster for which the conditional probability pi (kis maximal (with ties resolved arbitrarilythis gives the clustering of the points into redgreenand blue clusters in the figure for each mixture componentthe contour of the corresponding bivariate normal pdf is shown that encloses of the probability mass