Introduction k-nearest neighbors (knn) algorithm is a type of supervised ml algorithm which can be used for both classification as well as regression predictive problems. However



Download 0,73 Mb.
Pdf ko'rish
bet12/17
Sana31.12.2021
Hajmi0,73 Mb.
#222840
1   ...   9   10   11   12   13   14   15   16   17
Bog'liq
machine learning with python tutorial-139-150

 

We can use  accuracy_score function of  sklearn.metrics to  compute accuracy  of our 

classification model. 

Classification Report 

This report consists of the scores of Precisions, Recall, F1 and Support. They are explained 

as follows: 

Precision 

Precision,  used  in  document  retrievals,  may  be  defined  as  the  number  of  correct 

documents returned by our ML model. We can easily calculate it by confusion matrix with 

the help of following formula: 

𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 =

𝑇𝑃

𝑇𝑃 + 𝐹𝑃



 

Recall or Sensitivity 

Recall may be defined as the number of positives returned by our ML model. We can easily 

calculate it by confusion matrix with the help of following formula:

 

𝑅𝑒𝑐𝑎𝑙𝑙 =



𝑇𝑃

𝑇𝑃 + 𝐹𝑁


 

Specificity  

Specificity, in contrast to recall, may be defined as the number of negatives returned by 

our ML model. We can easily calculate it by confusion matrix with the help of following 

formula: 

𝑆𝑝𝑒𝑐𝑖𝑓𝑖𝑐𝑖𝑡𝑦 =

𝑇𝑁

𝑇𝑁 + 𝐹𝑃



 


Machine Learning with Python 

        


 

 

 



139 

 

Support  

Support may be defined as the number of samples of the true response that lies in each 

class of target values. 



F1 Score 

This score will give us the harmonic mean of precision and recall. Mathematically, F1 score 

is the weighted average of the precision and recall. The best value of F1 would be 1 and 

worst would be 0. We can calculate F1 score with the help of following formula: 

𝑭𝟏  =  𝟐  ∗   (𝒑𝒓𝒆𝒄𝒊𝒔𝒊𝒐𝒏  ∗  𝒓𝒆𝒄𝒂𝒍𝒍) / (𝒑𝒓𝒆𝒄𝒊𝒔𝒊𝒐𝒏  +  𝒓𝒆𝒄𝒂𝒍𝒍) 

     F1 score is having equal relative contribution of precision and recall. 

We can use classification_report function of sklearn.metrics to get the classification 

report of our classification model. 




Download 0,73 Mb.

Do'stlaringiz bilan baham:
1   ...   9   10   11   12   13   14   15   16   17




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish