{"id":4445,"date":"2021-08-03T12:30:49","date_gmt":"2021-08-03T12:30:49","guid":{"rendered":"https:\/\/www.bearloga.space\/?page_id=4445"},"modified":"2021-08-03T12:30:50","modified_gmt":"2021-08-03T12:30:50","slug":"algoritm-knn-poisk-blizhajshih-sosedej","status":"publish","type":"page","link":"https:\/\/www.bearloga.space\/en\/algoritm-knn-poisk-blizhajshih-sosedej\/","title":{"rendered":"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041a\u041d\u041d \u2014 \u043f\u043e\u0438\u0441\u043a \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c K-\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 (KNN) \u2014 \u044d\u0442\u043e \u0442\u0438\u043f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 ML, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.&nbsp;\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043e\u043d \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438.&nbsp;\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c KNN \u0445\u043e\u0440\u043e\u0448\u043e \u2014<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/strong>&nbsp;\u043b\u0435\u043d\u0438\u0432\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u2014 KNN \u2014 \u044d\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043b\u0435\u043d\u0438\u0432\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0437\u044b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/li><li><strong>\u041d\u0435\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/strong>&nbsp;\u2014 KNN \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/strong>&nbsp;\u043b\u0435\u043d\u0438\u0432\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u2014 KNN \u2014 \u044d\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043b\u0435\u043d\u0438\u0432\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0437\u044b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u041d\u0435\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/strong>&nbsp;\u2014 KNN \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u041a\u041d\u041d<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c K-\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 (KNN) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u00ab\u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432\u00bb \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043d\u043e\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u043e\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u0438\u0437\u043a\u043e \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u0447\u043a\u0430\u043c \u0432 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435.&nbsp;\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0448\u0430\u0433\u043e\u0432 \u2014<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 1<\/strong>&nbsp;\u2014 \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.&nbsp;\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0433\u0430 KNN \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0439.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 2<\/strong>&nbsp;\u2014 \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 K, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.&nbsp;K \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c \u0446\u0435\u043b\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 3<\/strong>&nbsp;\u2014 \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u2014<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>3.1<\/strong>&nbsp;\u2014 \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0439 \u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: \u0415\u0432\u043a\u043b\u0438\u0434\u043e\u0432\u043e, \u041c\u0430\u043d\u0445\u044d\u0442\u0442\u0435\u043d\u0441\u043a\u043e\u0435 \u0438\u043b\u0438 \u0425\u044d\u043c\u043c\u0438\u043d\u0433\u043e\u0432\u0441\u043a\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435.&nbsp;\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u2014 \u0435\u0432\u043a\u043b\u0438\u0434\u043e\u0432.<\/li><li><strong>3.2<\/strong>&nbsp;\u2014 \u0422\u0435\u043f\u0435\u0440\u044c, \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0438\u0445 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f.<\/li><li><strong>3.3<\/strong>&nbsp;\u2014 \u0414\u0430\u043b\u0435\u0435 \u043e\u043d \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u0432\u0435\u0440\u0445\u043d\u0438\u0435 K \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/li><li><strong>3.4<\/strong>&nbsp;\u2014 \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u043a.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3.1<\/strong>&nbsp;\u2014 \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0439 \u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: \u0415\u0432\u043a\u043b\u0438\u0434\u043e\u0432\u043e, \u041c\u0430\u043d\u0445\u044d\u0442\u0442\u0435\u043d\u0441\u043a\u043e\u0435 \u0438\u043b\u0438 \u0425\u044d\u043c\u043c\u0438\u043d\u0433\u043e\u0432\u0441\u043a\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435.&nbsp;\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u2014 \u0435\u0432\u043a\u043b\u0438\u0434\u043e\u0432.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3.2<\/strong>&nbsp;\u2014 \u0422\u0435\u043f\u0435\u0440\u044c, \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0438\u0445 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3.3<\/strong>&nbsp;\u2014 \u0414\u0430\u043b\u0435\u0435 \u043e\u043d \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u0432\u0435\u0440\u0445\u043d\u0438\u0435 K \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3.4<\/strong>&nbsp;\u2014 \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u043a.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 4<\/strong>&nbsp;\u2014 \u041a\u043e\u043d\u0435\u0446<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 K \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 KNN.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/coderlessons.com\/wp-content\/uploads\/2019\/07\/concept_of_k.png\" alt=\"\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u041a\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0447\u0435\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 (\u0432 \u0442\u043e\u0447\u043a\u0435 60, 60) \u0432 \u0441\u0438\u043d\u0438\u0439 \u0438\u043b\u0438 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441.&nbsp;\u041c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e K = 3, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d \u043d\u0430\u0439\u0434\u0435\u0442 \u0442\u0440\u0438 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.&nbsp;\u042d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u2014<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/coderlessons.com\/wp-content\/uploads\/2019\/07\/knn_algorithm.png\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u041a\u041d\u041d\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0442\u0440\u0435\u0445 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0447\u0435\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439.&nbsp;\u0421\u0440\u0435\u0434\u0438 \u044d\u0442\u0438\u0445 \u0442\u0440\u0435\u0445 \u0434\u0432\u0430 \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u043a \u041a\u0440\u0430\u0441\u043d\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0435\u0440\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0432 \u041a\u0440\u0430\u0441\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Python<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c K-\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 (KNN) \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.&nbsp;\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Python \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440\u0430 \u0432 Python:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u041d\u041d \u043a\u0430\u043a \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u0441 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 Python \u2014<a href=\"https:\/\/go.acstat.com\/338604f0f4238d20?wid=776&amp;pid=524&amp;dl=https%3A%2F%2Fskillbox.ru%2Fcourse%2Fprofession-test-new1%2F&amp;sid=40113cf0-e4cc-d9b5-25d0-72c2c46410cf\" target=\"_blank\" rel=\"noopener\">&nbsp;| \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a139 800&nbsp;\u20bd7 357&nbsp;\u20bd\/\u043c\u0435\u0441.\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import numpy as np\nimport matplotlib.pyplot as plt\nimport pandas as pd\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 iris \u0441 \u0432\u0435\u0431-\u0441\u0441\u044b\u043b\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">path = \"https:\/\/archive.ics.uci.edu\/ml\/machine-learning-databases\/iris\/iris.data\"\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">headernames = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'Class']\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 pandas dataframe \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dataset = pd.read_csv(path, names = headernames)\ndataset.head()\n<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th><\/th><th>\u0447\u0430\u0448\u0435\u043b\u0438\u0441\u0442\u043d\u0438\u043a \u0434\u043b\u0438\u043d\u044b<\/th><th>\u0447\u0430\u0448\u0435\u043b\u0438\u0441\u0442\u043d\u0438\u043a \u0448\u0438\u0440\u0438\u043d\u044b<\/th><th>\u041b\u0435\u043f\u0435\u0441\u0442\u043e\u043a \u0434\u043b\u0438\u043d\u0430<\/th><th>\u041b\u0435\u043f\u0435\u0441\u0442\u043e\u043a \u0448\u0438\u0440\u0438\u043d\u044b<\/th><th>\u0423\u0447\u0435\u0431\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441<\/th><\/tr><tr><td>0<\/td><td>5,1<\/td><td>3,5<\/td><td>1.4<\/td><td>0.2<\/td><td>Iris-setosa<\/td><\/tr><tr><td>1<\/td><td>4,9<\/td><td>3.0<\/td><td>1.4<\/td><td>0.2<\/td><td>Iris-setosa<\/td><\/tr><tr><td>2<\/td><td>4,7<\/td><td>3,2<\/td><td>1,3<\/td><td>0.2<\/td><td>Iris-setosa<\/td><\/tr><tr><td>3<\/td><td>4,6<\/td><td>3,1<\/td><td>1,5<\/td><td>0.2<\/td><td>Iris-setosa<\/td><\/tr><tr><td>4<\/td><td>5.0<\/td><td>3,6<\/td><td>1.4<\/td><td>0.2<\/td><td>Iris-setosa<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">X = dataset.iloc[:, :-1].values\ny = dataset.iloc[:, 4].values\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0430\u043b\u0435\u0435, \u043c\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0435\u0437\u0434\u0430 \u0438 \u0442\u0435\u0441\u0442\u044b.&nbsp;\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 60% \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 40% \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from sklearn.model_selection import train_test_split\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.40)\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0430\u043b\u0435\u0435, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from sklearn.preprocessing import StandardScaler\nscaler = StandardScaler()\nscaler.fit(X_train)\nX_train = scaler.transform(X_train)\nX_test = scaler.transform(X_test)\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0430\u043b\u0435\u0435 \u043e\u0431\u0443\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 sklearn \u043a\u043b\u0430\u0441\u0441\u0430 KNeighborsClassifier \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from sklearn.neighbors import KNeighborsClassifier\nclassifier = KNeighborsClassifier(n_neighbors = 8)\nclassifier.fit(X_train, y_train)\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u043d\u043e\u0437.&nbsp;\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">y_pred = classifier.predict(X_test)\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0417\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0439\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from sklearn.metrics import classification_report, confusion_matrix, accuracy_score\nresult = confusion_matrix(y_test, y_pred)\nprint(\"Confusion Matrix:\")\nprint(result)\nresult1 = classification_report(y_test, y_pred)\nprint(\"Classification Report:\",)\nprint (result1)\nresult2 = accuracy_score(y_test,y_pred)\nprint(\"Accuracy:\",result2)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u0412\u044b\u0445\u043e\u0434<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Confusion Matrix:\n[[21 0 0]\n[ 0 16 0]\n[ 0 7 16]]\nClassification Report:\n                  precision   recall   f1-score   support\n    Iris-setosa        1.00     1.00       1.00        21\nIris-versicolor        0.70     1.00       0.82        16\n Iris-virginica        1.00     0.70       0.82        23\n      micro avg        0.88     0.88       0.88        60\n      macro avg        0.90     0.90       0.88        60\n   weighted avg        0.92     0.88       0.88        60\n\nAccuracy: 0.8833333333333333\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u041d\u041d \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440\u0430<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u0441 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 Python \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import numpy as np\nimport pandas as pd\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 iris \u0441 \u0432\u0435\u0431-\u0441\u0441\u044b\u043b\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">path = \"https:\/\/archive.ics.uci.edu\/ml\/machine-learning-databases\/iris\/iris.data\"\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">headernames = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'Class']\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 pandas dataframe \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data = pd.read_csv(url, names = headernames)\narray = data.values\nX = array[:,:2]\nY = array[:,2]\ndata.shape\noutput&#x1f641;150, 5)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0417\u0430\u0442\u0435\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435&nbsp;<em>KNeighborsRegressor<\/em>&nbsp;\u0438\u0437&nbsp;<em>sklearn,<\/em>&nbsp;\u0447\u0442\u043e\u0431\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from sklearn.neighbors import KNeighborsRegressor\nknnr = KNeighborsRegressor(n_neighbors = 10)\nknnr.fit(X, y)\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 MSE \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">print (\"The MSE is:\",format(np.power(y-knnr.predict(X),2).mean()))\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u0412\u044b\u0445\u043e\u0434<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">The MSE is: 0.12226666666666669\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u041a\u041d\u041d<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Pros<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>\u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438.<\/li><li>\u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e \u0434\u0430\u043d\u043d\u044b\u0445.<\/li><li>\u042d\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.<\/li><li>\u041e\u043d \u0438\u043c\u0435\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u0435\u0441\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0447\u0435\u043c KNN.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u042d\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041e\u043d \u0438\u043c\u0435\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u0435\u0441\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0447\u0435\u043c KNN.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cons<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>\u042d\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/li><li>\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/li><li>\u041f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e N.<\/li><li>\u041e\u043d \u043e\u0447\u0435\u043d\u044c \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d \u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u042d\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e N.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041e\u043d \u043e\u0447\u0435\u043d\u044c \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d \u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u041a\u041d\u041d<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 KNN \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u0411\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">KNN \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043b\u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0434\u043b\u044f \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0440\u0435\u0434\u0438\u0442\u0430?&nbsp;\u0415\u0441\u0442\u044c \u043b\u0438 \u0443 \u044d\u0442\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u043d\u0435\u043f\u043b\u0430\u0442\u0435\u043b\u044c\u0449\u0438\u043a\u0430\u043c?<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u0420\u0430\u0441\u0447\u0435\u0442 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u044b\u0445 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u043e\u0432<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b KNN \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043b\u044e\u0434\u044c\u043c\u0438, \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0438 \u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0447\u0435\u0440\u0442\u044b.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 KNN \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u0431\u0438\u0440\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u0430\u043c, \u0442\u0430\u043a\u0438\u043c \u043a\u0430\u043a \u00ab\u0411\u0443\u0434\u0443 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u0442\u044c\u00bb, \u00ab\u041d\u0435 \u0431\u0443\u0434\u0443 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u0442\u044c\u00bb, \u00ab\u0411\u0443\u0434\u0443 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u043f\u0430\u0440\u0442\u0438\u044e\u00ab \u041a\u043e\u043d\u0433\u0440\u0435\u0441\u0441 \u00bb,\u00ab \u0411\u0443\u0434\u0443 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u043f\u0430\u0440\u0442\u0438\u044e \u00abBJP\u00bb.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c KNN, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0447\u0438, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0435\u0440\u043a\u0430, \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c K-\u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 (KNN) \u2014 \u044d\u0442\u043e \u0442\u0438\u043f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 ML, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[132],"tags":[],"class_list":["post-4445","page","type-page","status-publish","hentry","category-mashinnoe-obuchenie"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/pages\/4445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/comments?post=4445"}],"version-history":[{"count":0,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/pages\/4445\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/media?parent=4445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/categories?post=4445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/tags?post=4445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}