Solution 4.4 - Chemometrics: Data Analysis for the Laboratory and Chemical Plant
Education Article
- Published: Jan 1, 2000
- Channels: Chemometrics & Informatics
1. The centroids of each class are as follows.
|
Class |
x |
y |
z |
|
A |
0.44 |
0.52 |
0.24 |
|
B |
0.25 |
0.325 |
0.625 |
2. The Euclidean distances are as follows.

For objects 1 to 5, the distance to the centroid of A is less than that to the distance to the centroid of B, the reverse being true for objects 6 to 9. Hence Euclidean distances to class centroids suggest the original classification is confirmed.
3. The two class distances for the unknown are as follows.
|
Class distance A |
Class distance B | |
|
unknown |
0.236 |
0.411 |
Hence the object is most likely to belong to Class A.
4. The nine distances of the unknown are indicated below. The distances are ranked from 1 (closest) to 9 (farthest). The three closest are shaded in the table.

The three nearest neighbours are objects 3 (class A), 1 (class A) and 7 (class B) so it can be concluded that the object belongs to class A. Note that this is the result of a majority vote. However there are not a large number of objects in each class, and a larger training set would probably result in more unambiguous answers. This confirms the conclusion of question 4.
5. Probably object 7 as it has a fairly small distance to class A as well as class B (see question 3). Hence its inclusion in the three closest objects of question 4 may not be very significant.