Jumat, 11 Agustus 2017

Canberra Distance Example

You are given an example of the Canberra distance calculation in this article. My goal is to make it easier for you to understand the method of distance calculation with this method.

Given a dataset as 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
















Then from the above dataset. Taken a second data.

Sepal length
Sepal Width
Petal length
Petal Width
6.3
3.3
4.7
1.6





Calculate the distance between the second data and all the data contained in the data set above by using the canberra distance method?

Distance calculation with canberra distance can be formulated like this.


Let us calculate them

1. Calculate the distance between the second data and the first data


2. Calculate the distance between the second data and the fifth data



After all data is calculated then got result like following.

Sepal length
Sepal Width
Petal length
Petal Width
Distance
5.5
2.3
4
1.3
13.86645
6.3
3.3
4.7
1.6
15.9
5.2
2.7
3.9
1.4
13.85163
6.1
2.9
4.7
1.4
15.37796
7.1
3
5.9
2.1
18.88571
6.5
3
5.9
2.1
18.19047
7.2
3.6
6.1
2.5
20.49414
5.8
2.8
5.1
2.4
16.91599
7.7
2.6
6.9
2.3
20.83993
5.6
2.8
4.9
2
15.85518

Tidak ada komentar:

Posting Komentar