KNN Classification

3 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€48.10
List Price:  €67.34
You save:  €19.24
£39.96
List Price:  £55.94
You save:  £15.98
CA$71.89
List Price:  CA$100.65
You save:  CA$28.76
A$80.23
List Price:  A$112.33
You save:  A$32.10
S$67.90
List Price:  S$95.07
You save:  S$27.16
HK$388.49
List Price:  HK$543.93
You save:  HK$155.43
CHF 44.72
List Price:  CHF 62.61
You save:  CHF 17.89
NOK kr570.92
List Price:  NOK kr799.33
You save:  NOK kr228.41
DKK kr358.78
List Price:  DKK kr502.32
You save:  DKK kr143.54
NZ$88.75
List Price:  NZ$124.25
You save:  NZ$35.50
د.إ183.61
List Price:  د.إ257.07
You save:  د.إ73.45
৳5,996.77
List Price:  ৳8,395.96
You save:  ৳2,399.18
₹4,247.89
List Price:  ₹5,947.38
You save:  ₹1,699.49
RM225.35
List Price:  RM315.51
You save:  RM90.16
₦77,806.43
List Price:  ₦108,935.23
You save:  ₦31,128.80
₨13,966.08
List Price:  ₨19,553.63
You save:  ₨5,587.55
฿1,722.05
List Price:  ฿2,411.01
You save:  ฿688.96
₺1,759.09
List Price:  ₺2,462.87
You save:  ₺703.77
B$308.73
List Price:  B$432.25
You save:  B$123.52
R918.80
List Price:  R1,286.40
You save:  R367.59
Лв94.14
List Price:  Лв131.81
You save:  Лв37.66
₩72,428.88
List Price:  ₩101,406.23
You save:  ₩28,977.34
₪182.42
List Price:  ₪255.41
You save:  ₪72.98
₱2,941.21
List Price:  ₱4,117.93
You save:  ₱1,176.72
¥7,835.62
List Price:  ¥10,970.49
You save:  ¥3,134.87
MX$1,014.35
List Price:  MX$1,420.18
You save:  MX$405.82
QR183.15
List Price:  QR256.43
You save:  QR73.27
P691.23
List Price:  P967.77
You save:  P276.54
KSh6,461.20
List Price:  KSh9,046.20
You save:  KSh2,585
E£2,545.38
List Price:  E£3,563.73
You save:  E£1,018.35
ብር6,381.64
List Price:  ብር8,934.81
You save:  ብር2,553.16
Kz45,890.82
List Price:  Kz64,250.82
You save:  Kz18,360
CLP$49,572.58
List Price:  CLP$69,405.58
You save:  CLP$19,833
CN¥364.87
List Price:  CN¥510.85
You save:  CN¥145.97
RD$3,051.95
List Price:  RD$4,272.98
You save:  RD$1,221.02
DA6,726.62
List Price:  DA9,417.81
You save:  DA2,691.18
FJ$116.04
List Price:  FJ$162.47
You save:  FJ$46.42
Q386.56
List Price:  Q541.22
You save:  Q154.65
GY$10,499.17
List Price:  GY$14,699.69
You save:  GY$4,200.51
ISK kr6,951.10
List Price:  ISK kr9,732.10
You save:  ISK kr2,781
DH503.65
List Price:  DH705.15
You save:  DH201.50
L920.80
List Price:  L1,289.19
You save:  L368.39
ден2,960.95
List Price:  ден4,145.57
You save:  ден1,184.61
MOP$401.67
List Price:  MOP$562.37
You save:  MOP$160.70
N$917.26
List Price:  N$1,284.24
You save:  N$366.97
C$1,846.97
List Price:  C$2,585.91
You save:  C$738.93
रु6,832.10
List Price:  रु9,565.49
You save:  रु2,733.38
S/187.33
List Price:  S/262.28
You save:  S/74.94
K203.41
List Price:  K284.79
You save:  K81.38
SAR187.84
List Price:  SAR262.99
You save:  SAR75.15
ZK1,388.84
List Price:  ZK1,944.48
You save:  ZK555.64
L239.38
List Price:  L335.15
You save:  L95.77
Kč1,209
List Price:  Kč1,692.70
You save:  Kč483.70
Ft19,898.24
List Price:  Ft27,859.13
You save:  Ft7,960.89
SEK kr551.77
List Price:  SEK kr772.53
You save:  SEK kr220.75
ARS$51,090.27
List Price:  ARS$71,530.46
You save:  ARS$20,440.19
Bs346.77
List Price:  Bs485.50
You save:  Bs138.73
COP$218,877.66
List Price:  COP$306,446.24
You save:  COP$87,568.58
₡25,237.64
List Price:  ₡35,334.71
You save:  ₡10,097.07
L1,273.89
List Price:  L1,783.55
You save:  L509.65
₲392,023.82
List Price:  ₲548,864.71
You save:  ₲156,840.89
$U2,229.98
List Price:  $U3,122.15
You save:  $U892.17
zł204.96
List Price:  zł286.96
You save:  zł82
Already have an account? Log In

Transcript

Okay, for kn classification. So, we have a data set here, then we have other data points, then we have a data this yellow square that we want to predict or classify. So, for KNN algorithm, so, we will calculate all the distances between these yellow square and other data points then we will set a K that k maybe to tree. So, if k equal to tree we select a tree data points that is a or had the nearest distance from the data points to the yellow square here. So, when k equal to tree we will select a tree nearest data point. So, our In this case, we have a one rate star to green triangle.

So, we have two green triangle and one red star. So, two green triangle have a higher number. So these yellow square is being predicted classifiers green triangle. So if we set our k equal to seven, we will select the data points around seven data points arrows to the yellow square. So we have four races star tree green triangle. So for Red Star tree green triangle, so Raisa has a higher number.

So these are yellow squares being predictable classifiers are rista. So four key and this is post sudoko. So you loaded data initialized okay. So for getting the free data class, we iterate from all the data, calculate the distance between the data to the predict row and each row of the data set. And then we start the calculated distances, we get the top 10 kilos, no are we get a top kilos, then we get the most frequent cross and we return the most frequent Cross has to predict across. So if we want to know why is the K value wise the best k value for the training data, we can actually use some of the training data to train the KNN model.

Then, we also use some of the training data to actually test them all day and get the accuracy or the error. So we These are two graph here. We have a CV trained a model to k equal to 10. Then we have an era of around one. So k equal to 10. We have a era of 10 here.

So, if k is equal to 20, we have a era of around 1.3 k equal to 20. Here we have an era of aah, aah, pity. So let's say we want to choose the K value for myself I have chosen around 10 or maybe be higher or lower. Okay, so this is the KNN classification algorithm.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.