Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this exercise we will implement 1-dimensional GMM clustering algorithm from scratch. A GMM distribution is composed of k components, each characterized by: 1. A
In this exercise we will implement 1-dimensional GMM clustering algorithm from scratch. A GMM distribution is composed of k components, each characterized by: 1. A mixture proportion 2. A mean for its Normal Distribution 3. A variance for its Normal Distribution So, to generate a dataset that follows a GMM dsitrbution we need a list of those parameters. In this exercise we will use a class called Component to capture the parameters for given component. And a GMM will be a list of Components. class Component: def _init_(self, mixture_prop, mean, variance): \( \begin{array}{l}\text { self.mixture_prop = mixture_prop } \\ \text { self.mean = mean } \\ \text { self.variance }=\text { variance }\end{array} \) example_gmm = [Component (.5,5,1), Component (.5,8,1)] a) Complete the function below to validate and generate a dataset following a GMM distribution, given a specified set of GMM parameters as above and a size. You may only use the methods already imported in the cell. (10pts) b) Finish the implementation below of the Expectation-Maximization Algorithm. Only use methods that have been imported in the cell. (15pts) Notes: 1. your code should work with any number of components, each with reasonable parameters. 2. your code should work for 1 to about 5 iterations of the EM algorithm. It may not work for iterations over 10 because the math we are doing may overflow and create nans - that's ok / don't worry about it
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started