This article discusses examples of minkowski distance calculations using the data sets shown in the table below.
Sepal length
|
Sepal Width
|
Petal length
|
Petal Width
|
5.5
|
2.3
|
4
|
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
|
5.9
|
2.1
|
6.5
|
3
|
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
|
We will calculate the distance between the fourth data and all the data contained in the above dataset. Therefore we prepare the fourth data as follows.
Sepal length
|
Sepal Width
|
Petal length
|
Petal Width
|
6.1
|
2.9
|
4.7
|
1.4
|
We calculate the distance between the fourth data with all data by using the formula below.
Let us calculate the distance between the fourth data with the other data, here we assume with the value p = 3
1. Calculates the distance between the fourth data with the first data.
2. Calculate the distance between the fourth data and the second data.
The calculation of the distance between the fourth data and the other data is calculated in the same way as the above calculation. So after calculated all the results obtained as the following table.
Sepal length
|
Sepal Width
|
Petal length
|
Petal Width
|
Distance
|
5.5
|
2.3
|
4
|
1.3
|
0.840644
|
6.3
|
3.3
|
4.7
|
1.6
|
0.411953
|
5.2
|
2.7
|
3.9
|
1.4
|
1.016416
|
6.1
|
2.9
|
4.7
|
1.4
|
0
|
7.1
|
3
|
5.9
|
2.1
|
1.349216
|
6.5
|
3
|
5.9
|
2.1
|
1.236733
|
7.2
|
3.6
|
6.1
|
2.5
|
1.627151
|
5.8
|
2.8
|
5.1
|
2.4
|
1.008345
|
7.7
|
2.6
|
6.9
|
2.3
|
2.352796
|
5.6
|
2.8
|
4.9
|
2
|
0.663496
|
Tidak ada komentar:
Posting Komentar