We assume you have a collection of data points like the table below. We don't care about the type of data we use but the record for you is data should be numeric.
Sepal length
|
Sepal Width
|
Petal length
|
Petal Width
|
5.1
| 3.5 | 1.4 | 0.3 |
6.4
|
3.2
|
4.5
|
1.5
|
5.5
|
2.3
|
4.0
|
1.3
|
6.3
|
3.3
|
4.7
|
1.6
|
5.2
|
2.7
|
3.9
|
1.4
|
6.1
|
2.9
|
4.7
|
1.4
|
7.1
|
3.0
|
5.9
|
2.1
|
6.5
|
3.0
|
5.9
|
2.1
|
7.2
|
3.6
|
6.1
|
2.5
|
5.8
|
2.8
|
5.1
|
2.4
|
7.7
|
2.6
|
6.9
|
2.3
|
5.6
|
2.8
|
4.9
|
2.0
|
Then you want to measure the distance between the fifth data with other data. The fifth data is shown below.
Sepal length
|
Sepal Width
|
Petal length
|
Petal Width
|
5.2
|
2.7
|
3.9
|
1.4
|
Let's calculate the distance between the fifth data and the other data by using a formula like this.
So also the distance between the fifth data with the next data also use the same way as the above calculation. So after the calculation of all data has been completed then obtained results like the table below.
Sepal length
|
Sepal Width
|
Petal length
|
Petal Width
|
result
|
5.1
|
3.5
|
1.4
|
0.3
|
2.847806
|
6.4
|
3.2
|
4.5
|
1.5
|
1.43527
|
5.5
|
2.3
|
4
|
1.3
|
0.519615
|
6.3
|
3.3
|
4.7
|
1.6
|
1.5
|
5.2
|
2.7
|
3.9
|
1.4
|
0
|
6.1
|
2.9
|
4.7
|
1.4
|
1.220656
|
7.1
|
3
|
5.9
|
2.1
|
2.861818
|
6.5
|
3
|
5.9
|
2.1
|
2.503997
|
7.2
|
3.6
|
6.1
|
2.5
|
3.295451
|
5.8
|
2.8
|
5.1
|
2.4
|
1.676305
|
7.7
|
2.6
|
6.9
|
2.3
|
4.00874
|
5.6
|
2.8
|
4.9
|
2
|
1.236932
|
Tidak ada komentar:
Posting Komentar