MACHINE LEARNING
106403Module 4: Clustering, K-means, K-medoids, Density-based Hierarchical, Spectral .
Q1b. (b) A Machine Learning technique that helps in detecting the outliers in data is called as: - (i) Clustering . (ii) Classification (iii) Anomaly Detection (iv) All of the above20232m
Module 4: Clustering, K-means, K-medoids, Density-based Hierarchical, Spectral .
View this question on its own page →(b) A Machine Learning technique that helps in detecting the outliers in data is called as:
- (i) Clustering .
(ii) Classification
(iii) Anomaly Detection
(iv) All of the above
Worked SolutionAnswer: (iii) Anomaly Detection
Explanation:
- Anomaly Detection (also called outlier detection) is the ML technique explicitly designed to identify rare items, events or observations which raise suspicions by differing significantly from the majority of the data.
- Clustering groups similar data points; outliers may be found as points not belonging to any cluster, but it is not its primary purpose.
- Classification assigns data to predefined classes; it needs labeled outlier examples which are rarely available.
- Techniques used for Anomaly Detection: Statistical (Z-score, Gaussian), Density-based (LOF, DBSCAN), Distance-based, Isolation Forest, One-Class SVM, Autoencoders.
Hence the most specific answer is (iii) Anomaly Detection. Option (iv) All of the above is not best choice because clustering/classification are not primarily outlier detectors.
- (i) Clustering .
Q1i. What is the minimum number of variables/features required to perform clustering? (i) 0 (ii) 1 (iii) 2 (iv) 320222m
Module 4: Clustering, K-means, K-medoids, Density-based Hierarchical, Spectral .
View this question on its own page →What is the minimum number of variables/features required to perform clustering?
(i) 0
(ii) 1
(iii) 2
(iv) 3Worked SolutionAnswer: (ii) 1
Explanation:
- Clustering (K-means, hierarchical, DBSCAN) groups data points by similarity in feature space.
- Requires at least 1 feature/variable to compute distance/similarity. With 0 features there is no data to cluster.
- With 1 feature, 1D clustering is valid (e.g., points on a line clustered by value: {1,2,10} → clusters {1,2} and {10} via 1D K-means).
- While typically we use features for visualization, minimum mathematically is 1.
Therefore (ii) 1 is correct.
Q1i. A hypothesis which defines the population distribution is called .... (i) Null Hypothesis . (ii) Positive Hypothesis (iii) Negative Hypothesis (iv) Alternative Hypothesis20232m
Module 4: Clustering, K-means, K-medoids, Density-based Hierarchical, Spectral .
View this question on its own page →A hypothesis which defines the population distribution is called ....
(i) Null Hypothesis .
(ii) Positive Hypothesis
(iii) Negative Hypothesis
(iv) Alternative HypothesisWorked SolutionAnswer: (i) Null Hypothesis
Explanation:
- Null Hypothesis (): A hypothesis which defines the population distribution / assumes no effect, no difference. It is a statement to be tested and possibly rejected. Example: , distribution is Normal .
- Alternative Hypothesis ( / ): Complements , indicates existence of effect/difference.
- The term statistical hypothesis which completely specifies the population distribution (parameters) is called simple hypothesis; if does that it defines the distribution. In MCQ context, expected answer is Null Hypothesis.
Positive/Negative hypotheses are not standard statistical terms. Hence (i) Null Hypothesis is correct. If question meant simple hypothesis, null hypothesis is the standard example taught as defining population distribution under assumption.
Q8a. What is the difference between K-means and K-medoid algorithm? Explain density-based hierarchical clustering.20227m
Module 4: Clustering, K-means, K-medoids, Density-based Hierarchical, Spectral .
View this question on its own page →What is the difference between K-means and K-medoid algorithm? Explain density-based hierarchical clustering.
Worked SolutionK-means vs K-medoid:
Aspect K-means (Lloyd) K-medoid (PAM) Center Centroid = mean (not necessarily data point, continuous) Medoid = actual data point minimizing sum distance to cluster members Distance Euclidean (minimizes SSE) Any metric (Manhattan, arbitrary dissimilarity) Robustness Sensitive to outliers (mean shifts) Robust (medoid not affected by extreme outlier) Cost function Complexity fast per iteration (PAM) much slower, for large data When to use Continuous, spherical clusters, fast Categorical/mixed, need representatives from dataset, noisy data Density-Based Hierarchical Clustering:
Combines density and hierarchy. Unlike flat K-means, builds tree (dendrogram) where clustering reflects density connectivity at different thresholds.
Core idea: Clusters are dense regions separated by sparse regions. Define -neighborhood and . Point types: core (≥ in ), border, noise. Hierarchical variant (e.g., HDBSCAN, OPTICS, DENCLUE hierarchical) varies /density threshold to create hierarchy.
OPTICS: Ordering Points To Identify Clustering Structure — computes reachability distance, produces reachability plot, extracts hierarchy without fixing single .
HDBSCAN: Converts DBSCAN to hierarchical, builds minimum spanning tree of mutual reachability, condenses, selects stable clusters via persistence .
Hierarchical density dendrogram: Bottom leaves = core points merge at lowest density threshold as increases.
Advantages: Finds arbitrary shapes, handles noise, no need to preset , hierarchy reveals clusters at multiple densities.
Steps generic: Estimate density (kernel), build graph where edges if density > threshold, connected components = clusters, vary threshold → hierarchy, prune unstable branches.
Q8b. What is the difference between K-NN and K-means clustering algorithms?20237m
Module 4: Clustering, K-means, K-medoids, Density-based Hierarchical, Spectral .
View this question on its own page →What is the difference between K-NN and K-means clustering algorithms?
Worked SolutionK-NN vs K-means:
Aspect K-NN (K-Nearest Neighbors) K-means (Clustering) Type Supervised, instance-based, lazy classifier/regressor Unsupervised clustering Purpose Predict label for query using labeled neighbors Group unlabeled data into clusters minimizing SSE Input Labeled training Unlabeled only, need preset Working For query , find nearest labeled points by distance, majority vote / average: Iteratively assign points to nearest centroid , recompute mean, repeat until convergence Training No model building, stores data Builds model (centroids) Prediction cost per query (slow) after training (fast assign) Output Single label per query Cluster id for all points Choosing = neighborhood size via CV (bias-variance) = number clusters via elbow/silhouette Example Classify email as spam using 5 nearest labeled emails Segment customers into 3 groups without labels Common confusion: Both use distance and , but meanings completely different: in K-NN = neighbors to vote, in K-means = clusters. K-NN needs labels, K-means does not. K-NN predicts new point, K-means discovers structure.
When to use: Labels available + need classification → K-NN. No labels + need grouping → K-means.