Given K =5
And We have to predict for : sector = oil industry, income = medium, self-employed = yes, credit-rating fair
Also the similarity measure is given as : Similarity(tupleA, tupleB)=
where S(a, b) =1 if parameter "a" equals parameter "b" and =0 otherwise The parameters a(i), b(i) are either Sector, income, self-employed, or credit-rating. The weights w(i) are all 1, except for income, which is 2
NOTE: For calculating similarity measure we just use the given formula and corresponding value of S and W, depending on the case if they match our training set and the query or not.
Person ID | Sector of Activity | Income | Self-employed | Credit Rating | Similarity Measure Value |
1 | farming | medium | No | Fair | 0+2+0+1 = 3 |
2 | farming | low | yes | Fair | 0+0+1+1 = 2 |
3 | oil industry | medium | No | Fair | 1+2+0+1 = 4 |
4 | oil industry | low | yes | fair | 1+0+1+1 = 3 |
5 | oil industry | medium | yes | excellent | 1+2+1+0 = 4 |
6 | banking | medium | no | excellent | 0+2+0+0 = 2 |
7 | oil industry | high | no | fair | 1+0+0+1 = 2 |
8 | oil industry | high | no | excellent | 1+0+0+0 = 1 |
9 | banking | high | no | fair | 0+0+0+1 = 1 |
10 | farming | low | yes | excellent | 0+0+1+0 = 1 |
11 | banking | low | yes | excellent | 0+0+1+0 = 1 |
12 | farming | medium | yes | fair | 0+2+1+1 = 1 |
13 | banking | high | yes | fair | 0+0+1+1 = 2 |
14 | farming | medium | no | excellent | 0+2+0+0 = 2 |
Person ID |
Sector of Activity |
Income |
Self- employed |
Credit Rating |
Similarity Measure Value |
Rank Highest Similarity Measure |
Can we include it in (K=5) Nearest Neighbour |
Y=Category Of Nearest Neighbour |
1 |
farming |
medium |
No |
Fair |
0+2+0+1 = 3 |
3 |
YES |
No |
2 |
farming |
low |
yes |
Fair |
0+0+1+1 = 2 |
5 |
YES |
No |
3 |
oil industry |
medium |
No |
Fair |
1+2+0+1 = 4 |
1 |
YES |
No |
4 |
oil industry |
low |
yes |
fair |
1+0+1+1 = 3 |
4 |
YES |
Yes |
5 |
oil industry |
medium |
yes |
excellent |
1+2+1+0 = 4 |
2 |
YES |
Yes |
6 |
banking |
medium |
no |
excellent |
0+2+0+0 = 2 |
6 |
NO |
Yes |
7 |
oil industry |
high |
no |
fair |
1+0+0+1 = 2 |
8 |
NO |
No |
8 |
oil industry |
high |
no |
excellent |
1+0+0+0 = 1 |
10 |
NO |
No |
9 |
banking |
high |
no |
fair |
0+0+0+1 = 1 |
11 |
NO |
Yes |
10 |
farming |
low |
yes |
excellent |
0+0+1+0 = 1 |
12 |
NO |
Yes |
11 |
banking |
low |
yes |
excellent |
0+0+1+0 = 1 |
13 |
NO |
Yes |
12 |
farming |
medium |
yes |
fair |
0+2+1+1 = 1 |
14 |
NO |
No |
13 |
banking |
high |
yes |
fair |
0+0+1+1 = 2 |
8 |
NO |
Yes |
14 |
farming |
medium |
no |
excellent |
0+2+0+0 = 2 |
9 |
NO |
Yes |
So we can see that we have 3 No and 2 yes so our final answer class label will be "No".
(Note: here we had to choose one among several choices for the fifth neighbour so we selected one randomly. and there will be a change of answer if we had chose another one. So in such case we just select a random one and make our decision of the class)
Given the training data in Question 1 below| (on buying RRSP8), predict the class of the following new example using k...
Given the training data in Question 1 below| (on buying RRSP8), predict the class of the following new example using k-nearest-neighbor classification fork = 5: sector = oil industry, income = medium, self-employed = yes, credit-rating fair. For distance measure, use the following similarity measure: similarity(tupleAtupleB)-4-.(w"S(ab/4), where S(ab) is 1 if parameter a equals parameter b and o otherwise The parameters atand biare either Sector, income, self-employed, or credit-rating. The weights wiare all 1, except for income, which is 2....
Question 3 Given the following data points, use the K-Nearest Neighbours (kNN) (k=5) to find the class for age<=30, income=medium, student=yes, credit-rating=fair. Show your calculations and the final clusters. For similarity measure use a simple match of attribute values: Similarity(A,B)= equals bi and 0 otherwise. ai and b i are either age, income, student or credit_rating. Weights are all 1 except for income it is 2. 5%, *c(a,,b,)/4 ,h ) is 1 ifai where cla -1 studentcredit rating dass RID...
Question 63 (1 point) Which of the following is an example of an external cost (or negative externality)?! The fall in the price of wheat because good weather produced a large crop O A company moves a factory to China, closing its Canadian factory. The fall in the price of gasoline because oil prices are falling, making Canadian oil industry workers jobless. Taxes are increased to pay for increased government spending during the pandemic. The increased chance of getting the...