# Committee Machine Learning for Electrofacies-Guided Well Placement and Oil Recovery Optimization
## 2 Data and Methodology
### Methods
#### 2.2.4 Gaussian Mixture Model  
The Gaussian mixture model represents a probabilistic framework that posits that all observed data points originate from a combination of a finite set of Gaussian distributions, the parameters of which remain unknown. This model can be viewed as an extension of k-means clustering, as it integrates information regarding the covariance structure of the data alongside the centroids of the underlying Gaussian distributions. This approach serves as a soft clustering method within the realm of unsupervised learning, enabling the assessment of the likelihood that a specific data point is associated with a particular cluster [40].  
Each Gaussian component in the mixture is indicative of a cluster and is characterized by three parameters:  
1. Mean (\(\mu_{k}\))--denotes the central point for the cluster.
2. Covariance matrix (\(\Sigma_{k}\))--is the spread of the cluster and can be visualized as an ellipsoid in multidimensional space.
3. The mixing probability (\(\tau_{k}\))--denotes the relative weight or the cluster importance where \(\Sigma_{k=1}^{K}\tau_{k}=1\).  
The model consists of multiple Gaussian components, each denoted by k \(\in\) {1,\(\ldots\), K}, where K signifies the total number of clusters present in the dataset. Each Gaussian component k within the mixture is characterized by a mean that indicates its central location,  
Figure 2: Flowcharts for agglomerative hierarchical clustering (**a**) and divisive hierarchical clustering (**b**).  
a covariance that determines its spread--which can be visualized as the dimensions of an ellipsoid in a multivariate context--and a mixing probability that indicates the relative size or influence of the Gaussian function.  
The probability density function of the GMM for any data point can be expressed as  
\[p(x)=\sum_{k=1}^{K}\pi_{k}\;N\;(x\mid\mu_{k},\;\Sigma_{k}), \tag{9}\]  
where K refers to the total number of clusters and N (x\(\mid\mu_{k},\;\Sigma_{k}\)) is the PDF of the k-th Gaussian component:  
\[N(x\mid\mu_{k},\;\Sigma_{k})=\frac{1}{\left(2\pi\right)^{d/2}\mid,\;\Sigma_{k} \right\rvert^{1/2}}\;exp(-0.5\;(x-\mu_{k})^{T}(x-\mu_{k})) \tag{10}\]  
where x is the d-dimensional data point; \(\mu_{k}\) is the mean vector for the k-th Gaussian component; \(\Sigma_{k}\) represents the covariance matrix for the k-th component; \(\mid\Sigma_{k}\mid\) is the determinant of the covariance matrix; and the Mahalanobis distance measures the distance of x from \(\mu_{k}\).  
Fitting the GMM Using the Expectation-Maximization Approach  
The various parameters of the GMM (\(\mu_{k},\;\Sigma_{k}\), and \(\pi_{k}\)) are determined using the Expectation-Maximization (EM) algorithm, which works by alternating between two key steps in an iterative process:  
1. The expectation step (E-step): To calculate for \(\gamma ik\), which refers to the posterior probability that any data point \(x_{i}\) belongs to the cluster k, is given by \[\gamma ik=\frac{\pi_{k}\;N\;(x_{i}\mid\mu_{k},\;\Sigma_{k})}{\sum_{j=1}^{K} \pi_{j}\;N\;(x_{i}\mid\mu_{j},\;\Sigma_{j})}\] (11)
2. The maximization step (M-step): The parameters are now updated depending on their current responsibilities: \[\text{Mean}:\;\mu_{k}=\frac{\sum_{i=1}^{N}\gamma ik\;x_{i}}{\sum_{i=1}^{N} \gamma ik}\] (12) \[\text{Covariance}:\;\Sigma_{k}=\frac{\sum_{i=1}^{N}\gamma ik\;(x_{i}-\mu_{k} )\;(x_{i}-\mu_{k})^{T}}{\sum_{i=1}^{N}\gamma ik}\] (13) \[\text{Mixing probability}:\;\pi_{k}=\frac{\sum_{i=1}^{N}\gamma ik}{N}\] (14)  
The process is repeated until convergence, which typically is where the log-likelihood of the data:  
\[log\;p\;(X)=\sum_{i=1}^{N}\text{log}(\sum_{k=1}^{K}\pi_{k}\;N\;(x_{i}\mid\mu_ {k},\;\Sigma_{k})), \tag{15}\]  
does not improve significantly any longer [41].