Pertanyaan :
- Describe the steps of the k-Means clustering algorithm. What does the ‘k’ represent?
- Why is dimensionality reduction useful in machine learning?
- Provide a real-world application for clustering (e.g., customer segmentation).
- What is the main objective of PCA?
Jawaban:
1.Steps of the k-Means clustering algorithm:
- Choose the value of k ,Decide the number of clusters desired.
- Initialize centroids ,Select k initial points as centroids (cluster centers), either randomly or using the k-Means++ method.
- Assignment ,Calculate the distance from each data point to every centroid (usually using Euclidean Distance), then assign each data point to the nearest centroid.
- Update , Recalculate each centroid’s position as the mean of all data points assigned to that centroid.
- Iterate , Repeat steps 3 and 4 until:
- Centroids no longer change (convergence), or
- The maximum number of iterations is reached, or
- The change in centroid positions falls below a certain threshold.
Meaning of ‘k’:
‘k’ represents the number of clusters (groups) to be formed from the data. The value of k is determined by the user before the algorithm runs. For example, if k = 3, the algorithm will divide the data into 3 groups.
2.
- Combating the Curse of Dimensionality ,The more features, the sparser the data and the harder it is for models to find patterns.
- Faster computation , Lower-dimensional data requires shorter training and prediction times.
- Reducing overfitting , Too many features can cause a model to memorize noise; dimensionality reduction helps the model generalize better.
- Data visualization,High-dimensional data is hard to visualize; reducing to 2D or 3D enables informative visualization.
- Noise reduction , Components with small variance are often noise and can be discarded.
- Saving storage and memory ,More compact data is more efficient to store and process.
- Removing multicollinearity , Highly correlated features can confuse linear models.
3.
Real-world application of clustering: Customer Segmentation
A retail company wants to better understand its customers. Using k-Means Clustering, the company groups customers based on:
- Purchase frequency
- Average transaction value
- Types of products purchased
- Recency of last purchase
As a result, the company discovers several segments, such as:
- Loyal Customers ,frequent shoppers, high transaction value
- Budget Customers , frequent shoppers, low transaction value
- Premium Customers , infrequent shoppers, very high transaction value
- Passive Customers , infrequent shoppers, low transaction value
Benefits:
- More targeted marketing strategies
- Personalized promotions for each segment
- Marketing budget efficiency
- Improved customer retention
Other examples:
- Grouping news articles by topic
- Anomaly detection in credit card transactions
- Medical image segmentation (healthy vs diseased tissue)
- Grouping genes based on expressio
4.
The main objective of PCA is to reduce the dimensionality of data from a high-dimensional space to a lower-dimensional space, while retaining as much variance (information) as possible from the original data.
PCA achieves this by:
- Finding new axes (principal components) that are mutually perpendicular (orthogonal)
- Ordering these axes by the amount of variance they capture
- The first principal component (PC1) captures the largest variance
- The second principal component (PC2) captures the next largest variance, and so on
- By selecting the top few principal components, we can represent the data in fewer dimensions without losing too much information
In essence: PCA transforms data into a new coordinate system where the data’s variance is maximized along the first few dimensions, allowing the remaining dimensions to be discarded.
