# Committee Machine Learning for Electrofacies-Guided Well Placement and Oil Recovery Optimization
## 2 Data and Methodology
### Methods
#### 2.2.5 Spectral Clustering  
Spectral clustering is a collection of techniques that depend on the eigenstructure of a similarity matrix to divide data points into non-overlapping clusters, characterized by high similarity among points within the same cluster and low similarity between points in different clusters. Unlike traditional clustering algorithms like k-means, which rely only on geometric properties of the data, the spectral clustering method represents a specific type of clustering algorithm that capitalizes on the relationships among data points to create clusters. This makes the algorithm perform well in identifying clusters with arbitrary shapes or when the data is not linearly separable. It employs the eigenvalues and eigenvectors of the data matrix to reduce dimensionality, thereby aiding in the clustering of data points. The foundational concept involves a graph representation of the data, where each data point is a node and the edges signify the similarities between these points [42]. The spectral clustering algorithm consists of constructing a graph through the affinity or similarity matrix, segmenting the data points into smaller dimensional spaces, and using eigenvalues and eigenvectors to define subgraphs. This clustering algorithm typically involves the following approach:  
1. Constructing the similarity graph: The first step is to create a graph that is a representation of the data. This graph is constructed according to the similarity matrix W, where \(W_{ij}\) represents the similarity between data points i and j. Common approaches for constructing the graph include the following:  
* The k-nearest neighbor graph, which connects each point to its k-nearest neighbors.
* The epsilon, which connects points that lie within a threshold distance \(\epsilon\).
* The fully connected graph on which all points are connected and the weights determined by the similarity function.  
For example, a Gaussian kernel is often used to define the similarity:  
\[W_{ij}=exp\ (-\frac{\left|\left|x_{i}-x_{j}\right|\right|^{2}}{2\sigma^{2}}), \tag{16}\]  
where \(x_{i}\) and \(x_{j}\) are data points, and \(\sigma\) controls the width of the kernel.
2. Computing the Laplacian matrix: Using the similarity matrix W, a Laplacian matrix L is derived [43]. The Laplacian holds and contains important structural information about the graph and comes in different forms, such as the following:  
the unnormalized Laplacian  
\[L=D-W \tag{17}\]  
normalized Laplacian  
\[L_{sym}=D^{-1/2}\ L\ D^{-1/2}\]  
, (18)  
or random-walk Laplacian  
\[L_{rw}=D^{-1}\ L \tag{19}\]  
where \(D\) is the diagonal degree matrix with \(D_{ii}=\Sigma_{j}\ W_{ij}\) (20)
3. Dimensionality reduction using eigen decomposition: The eigenvalues and eigenvectors of the graph Laplacian are computed. The eigenvectors are related to the smallest non-zero eigenvalues and capture the underlying structure of the data. It is used to embed the data points into a lower-dimensional space. This step effectively transforms the clustering problem into a geometric partitioning problem.
4. Clustering in the reduced space: In the final step, a standard clustering algorithm (e.g., k-means) is applied to the transformed data in the lower-dimensional space, defined by the eigenvectors. This results in obtaining the final cluster points.