{"id":290428,"date":"2018-10-07T16:45:03","date_gmt":"2018-10-07T12:45:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=290428"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=290428","title":{"rendered":"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043c\u043e\u0448\u0435\u043d\u043d\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Enron dataset. \u0427\u0430\u0441\u0442\u044c 2-\u0430\u044f, \u043f\u043e\u0438\u0441\u043a \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u044b\u0445 \u0432 \u043c\u043e\u0448\u0435\u043d\u0438\u043d\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 Enron Dataset. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/habr.com\/post\/424891\/\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043f\u0440\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0430\u0441\u0442 \u043e\u0442\u0432\u0435\u0442: \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0432 \u043c\u043e\u0448\u0435\u043d\u0438\u0447\u0435\u0441\u0442\u0432\u0435?<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hn\/gs\/0i\/hngs0ix8h0znhrykvqefaqfdcey.png\" alt=\"Enron\"><\/div>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u043e\u0432, \u0434\u0430\u044e\u0449\u0438\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u043e \u0434\u0435\u043b\u0443 \u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Enron \u0438 \u043c\u043e\u0448\u0435\u043d\u043d\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432 \u043d\u0435\u0439. \u0422\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043f\u0440\u043e\u0431\u0435\u043b\u044b(NaN), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0438 \u043f\u0440\u043e\u0448\u043b\u0438 \u043e\u0442\u0431\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u043c\u043d\u043e\u0433\u0438\u043c:<\/p>\n<p>  <\/p>\n<ul>\n<li>X_train \u0438 y_train \u2014 \u0432\u044b\u0431\u043e\u0440\u043a\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f(111 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 );<\/li>\n<li>X_test \u0438 y_test \u2014 \u0432\u044b\u0431\u043e\u0440\u043a\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u043d\u0430\u0448\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 (28 \u0437\u0430\u043f\u0438\u0441\u0435\u0439).<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438 \u043e \u043c\u043e\u0434\u0435\u043b\u044f\u0445\u2026 \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u044e\u0449\u0438\u0445 \u0435\u0433\u043e \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0432 \u044d\u0442\u043e\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435, \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0438\u0437 Sklearn:<\/p>\n<p>  <\/p>\n<ul>\n<li>Naive Bayes (\u043d\u0430\u0438\u0432\u043d\u044b\u0439 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440); <\/li>\n<li>SVM (\u043c\u0430\u0448\u0438\u043d\u0430 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432);<\/li>\n<li>K-nearest neighbors (\u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0438\u0441\u043a\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439);<\/li>\n<li>Random Forest (\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043b\u0435\u0441);<\/li>\n<li>Neural Network (\u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438). <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u044c:<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6_\/te\/_i\/6_te_ipyv37mympp3nt1peuxq74.png\" alt=\"image\"><\/div>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043d\u0438\u0445 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0435 \u043c\u043d\u043e\u0433\u0438\u043c Decision Tree (\u0434\u0435\u0440\u0435\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439), \u043d\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Random Forest, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <abbr title=\"\u043d\u0430\u0431\u043e\u0440 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430\">\u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0435\u043c<\/abbr> \u0438\u0437 \u0440\u0435\u0448\u0430\u044e\u0449\u0438\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0435\u0433\u043e \u043d\u0430 Logistic Regression (\u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f), \u0447\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 (0 \u0438\u043b\u0438 1). <\/p>\n<p>  <\/p>\n<h2 id=\"nachalo\">\u041d\u0430\u0447\u0430\u043b\u043e<\/h2>\n<p>  <\/p>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code>from sklearn.naive_bayes import GaussianNB from sklearn.linear_model import LogisticRegression from sklearn.neighbors import KNeighborsClassifier from sklearn.svm import SVC from sklearn.neural_network import MLPClassifier from sklearn.ensemble import RandomForestClassifier  random_state = 42 gnb = GaussianNB() svc = SVC() knn = KNeighborsClassifier() log = LogisticRegression(random_state=random_state) rfc = RandomForestClassifier(random_state=random_state) mlp = MLPClassifier(random_state=random_state)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c \u0438\u0445, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u043a\u0430\u043a \u0441 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c\u044e, \u0430 \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u0438\u0445 \u0432\u0441\u0435 \u0441\u0440\u0430\u0437\u0443:<\/p>\n<p>  <\/p>\n<pre><code>classifiers = [gnb, svc, knn, log, rfc, mlp] for clf in classifiers:     clf.fit(X_train, y_train)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u044b\u043b\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u044b, \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u0445 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Seaborn:<\/p>\n<p>  <\/p>\n<pre><code>from sklearn.metrics import accuracy_score def calculate_accuracy(X, y):     result = pd.DataFrame(columns=['classifier', 'accuracy'])     for clf in classifiers:         predicted = clf.predict(X_test)         accuracy = round(100.0 * accuracy_score(y_test, predicted), 2)         classifier = clf.__class__.__name__         classifier = classifier.replace('Classifier', '')         result = result.append({'classifier': classifier, 'accuracy': accuracy}, ignore_index=True)         print('Accuracy is {accuracy}% for {classifier_name}'.format(accuracy=accuracy, classifier_name=classifier))      result = result.sort_values(['classifier'], ascending=True)     plt.subplots(figsize=(10, 7))     sns.barplot(x=\"classifier\", y='accuracy', palette=cmap, data=result)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0433\u043b\u044f\u0434\u0438\u043c \u043d\u0430 \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code>calculate_accuracy(X_train, y_train) <\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ob\/ej\/lk\/obejlkx9brbl1tw_gqauqm8h66a.png\"><br \/>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f \u043e\u043a\u043e\u043b\u043e 90%. \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0431\u043b\u0435\u0441\u0442\u044f\u0449\u0435!<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0432\u0441\u0451 \u0442\u0430\u043a \u0440\u0430\u0434\u0443\u0436\u043d\u043e.<\/b><\/p>\n<div class=\"spoiler_text\">\n<p>\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0439. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 28 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, 4 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u044b\u043c\u0438, \u0430 24 \u0441 \u0442\u0435\u043c\u0438, \u043a\u0442\u043e \u0432\u043d\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u044f. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code>def QuaziAlgo(features):     return 0<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u0442\u0434\u0430\u043b\u0438 \u0435\u043c\u0443 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0430\u0448\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u0447\u0442\u043e \u0432\u0441\u0435 28 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043d\u0435\u0432\u0438\u043d\u043e\u0432\u043d\u044b. \u041a\u0430\u043a\u043e\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c (accuracy) \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435? <\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/459\/44e\/7e1\/45944e7e11dfb71a1a3c8e2679303dd6.svg\" alt=\"$Accuracy = \\frac{P}{N} = \\frac{24}{28} \\approx 0.857$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0443 KNeighbors \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f&#8230;<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041d\u043e \u0432\u0441\u0451 \u0442\u0430\u043a\u0438, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043e\u0431\u043e\u043b\u044c\u0449\u0430\u0442\u044c\u0441\u044f, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043e\u0448\u0438\u0431\u043e\u043a (confusion matrix) \u0434\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code>from sklearn.metrics import confusion_matrix def make_confussion_matrices(X, y):     matrices = {}     result = pd.DataFrame(columns=['classifier', 'recall'])     for clf in classifiers:         classifier = clf.__class__.__name__         classifier = classifier.replace('Classifier', '')         predicted = clf.predict(X_test)         print(f'{predicted}-{classifier}')         matrix = confusion_matrix(y_test,predicted,labels=[1,0])         matrices[classifier] = matrix.T     return matrices<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0448\u0438\u0431\u043e\u043a \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u044d\u0442\u0438\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438:<\/p>\n<p>  <\/p>\n<pre><code>matrices = make_confussion_matrices(X_train,y_train)<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jg\/i9\/r-\/jgi9r-1raw4acxfo5tdtsgyh9qw.png\"><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0436\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0445\u0432\u0430\u0442\u0438\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u044f\u0432\u043d\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a.<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0432\u044b\u044f\u0432\u0438\u043b \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u0432\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0412 \u0447\u0435\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 KNeighbors?<\/li>\n<li>\u0417\u0430\u0447\u0435\u043c \u043c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0448\u0438\u0431\u043e\u043a, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0445, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f?<\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"zaglyanem-glubzhe\">\u0417\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0433\u043b\u0443\u0431\u0436\u0435<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0448\u0438\u0431\u043e\u043a, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0433\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code>import itertools from collections import Iterable def draw_confussion_matrices(row,col,matrices,figsize = (16,12)):     fig, (axes) = plt.subplots(row,col, sharex='col', sharey='row',figsize=figsize )     if any(isinstance(i, Iterable) for i in axes):         axes =  list(itertools.chain.from_iterable(axes))      idx = 0     for name,matrix in matrices.items():         df_cm = pd.DataFrame(             matrix, index=['True','False'], columns=['True','False'],          )          ax = axes[idx]         fig.subplots_adjust(wspace=0.1)         sns.heatmap(df_cm, annot=True,cmap=cmap,cbar=False ,fmt=\"d\",ax=ax,linewidths=1)          ax.set_title(name)         idx += 1<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0438\u0445 \u0432 2 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 3 \u0441\u0442\u043e\u043b\u0431\u0446\u0430:<\/p>\n<p>  <\/p>\n<pre><code>draw_confussion_matrices(2,3,matrices)<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/er\/_e\/6q\/er_e6q34-nsppof3cmoo--rfyyk.png\"><\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c, \u0441\u0442\u043e\u0438\u0442 \u0434\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f. \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 True, \u0447\u0442\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e \u0441\u043b\u0435\u0432\u0430 \u043e\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0448\u0438\u0431\u043e\u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430, \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u044b\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 False \u2014 \u0447\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0432\u043d\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u044f. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e True \u0438 False \u0432\u043d\u0438\u0437\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430.<\/em><\/p>\n<p>  <\/p>\n<p><em>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f KNeighbors \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432 85.71% \u0441\u043e\u0432\u043f\u0430\u043b\u043e \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u0435\u043b, \u043a\u043e\u0433\u0434\u0430 24 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u0447\u0442\u043e \u0431\u044b\u043b\u0438 \u0432\u043d\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u044f, \u0431\u044b\u043b\u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430. \u041d\u043e 4 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u043e\u0436\u0435 \u0431\u044b\u043b\u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u044d\u0442\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a. \u0415\u0441\u043b\u0438 \u0431\u044b \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443-\u0442\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0441\u0443\u0434\u0430.<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0448\u0438\u0431\u043e\u043a \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0418\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0432 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043d\u0438\u043c.<\/p>\n<p>  <\/p>\n<h2 id=\"metriki\">\u041c\u0435\u0442\u0440\u0438\u043a\u0438<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u043e\u0439:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cu\/4l\/2w\/cu4l2wliuqbqanpptc1y-rq3scu.png\"><\/p>\n<p>  <\/p>\n<p><strong>\u0410 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 TP, TN, FP \u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e FN \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435?<\/strong><\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d37\/76b\/f92\/d3776bf9243ad7f10adf69412734b436.svg\" alt=\"$TP\\ \u2014\\ \u0438\u0441\u0442\u0438\u043d\u043d\u043e-\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435\\ \u0440\u0435\u0448\u0435\u043d\u0438\u0435\\\\ TN\\ \u2014\\ \u0438\u0441\u0442\u0438\u043d\u043d\u043e-\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435\\ \u0440\u0435\u0448\u0435\u043d\u0438\u0435\\\\ FP\\ \u2014\\ \u043b\u043e\u0436\u043d\u043e-\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435\\ \u0440\u0435\u0448\u0435\u043d\u0438\u0435\\\\ FN\\ \u2014\\ \u043b\u043e\u0436\u043d\u043e-\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435\\ \u0440\u0435\u0448\u0435\u043d\u0438\u0435$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043c\u044b \u0441\u0442\u0440\u0435\u043c\u0438\u043c\u0441\u044f \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0446\u0438\u0444\u0440\u044b \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u044f\u0447\u0435\u0439\u043a\u0430\u043c\u0438 TP \u0438 TN (\u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f) \u0438 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u043b\u0438 \u0432 FN \u0438 FP(\u043b\u043e\u0436\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f).<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0441\u0451 \u0442\u0430\u043a \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u0438 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0434\u0438\u0433\u043d\u043e\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u043a\u0430, FP \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u0447\u0435\u043c FN, \u0438\u0431\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u043e\u0436\u043d\u043e\u0433\u043e \u0432\u0435\u0440\u0434\u0438\u043a\u0442\u0430 \u043e \u0440\u0430\u043a\u0435, \u043f\u0430\u0446\u0438\u0435\u043d\u0442\u0443 \u043f\u0440\u043e\u043f\u0438\u0448\u0443\u0442 \u043b\u0435\u043a\u0430\u0440\u0441\u0442\u0432\u0430 \u0438 \u0431\u0443\u0434\u0443\u0442 \u0435\u0433\u043e \u043b\u0435\u0447\u0438\u0442\u044c. \u0414\u0430, \u044d\u0442\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0435\u0433\u043e \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u0438 \u043a\u043e\u0448\u0435\u043b\u0435\u043a, \u043d\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u044d\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0435 \u043e\u043f\u0430\u0441\u043d\u044b\u043c, \u043d\u0435\u0436\u0435\u043b\u0438 FN \u0438 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u044c \u043c\u0430\u043b\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438.<br \/>  \u0427\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u044b\u0445 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435? \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, FN \u043d\u0435 \u0442\u0430\u043a \u0441\u0442\u0440\u0430\u0448\u0435\u043d, \u043a\u0430\u043a FP. \u0412\u043f\u0440\u043e\u0447\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u0434\u0430\u043b\u0435\u0435\u2026<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0418 \u0440\u0430\u0437 \u0440\u0435\u0447\u044c \u0437\u0430\u0448\u043b\u0430 \u043e\u0431 \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0430\u0445, \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u0445 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 (Precision) \u0438 \u043f\u043e\u043b\u043d\u043e\u0442\u044b (Recall).<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0442\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u0442\u043e <strong>Precision<\/strong> \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u043a\u0430\u043a:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/m8\/5g\/uu\/m85guuomhqmesua0dzx308wpb2g.png\"><br \/>  \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0432\u0435\u0434\u0451\u0442\u0441\u044f \u0441\u0447\u0451\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c\u0438. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0442\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0438\u0441\u043b\u043e \u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0439 (\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0432\u043d\u0430 1, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e FP).<\/p>\n<p>  <\/p>\n<p><strong>Recall<\/strong> \u0436\u0435 \u0432 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043a\u0430\u043a:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nx\/wa\/a-\/nxwaa-k0dt94hv2t5t4fv3wfk78.png\"><br \/>  Recall \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u00ab\u0443\u0433\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u00bb \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438\u0437 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445. \u0427\u0435\u043c \u0432\u044b\u0448\u0435 \u043f\u043e\u043b\u043d\u043e\u0442\u0430 \u2014 \u0442\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0431\u044b\u043b\u043e FN. <\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0441\u0442\u0430\u0440\u0430\u044e\u0442\u0441\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f, \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u0434\u0430\u043d Precision. \u041f\u0440\u0438\u0447\u0438\u043d\u0430: \u0431\u043e\u043b\u0435\u0435 \u0433\u0443\u043c\u0430\u043d\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043b\u043e\u0436\u043d\u043e-\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u0435 \u043f\u0430\u0434\u0430\u043b\u043e \u043d\u0430 \u043d\u0435\u0432\u0438\u043d\u043e\u0432\u043d\u043e\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c Precision \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code>from sklearn.metrics import precision_score def calculate_precision(X, y):     result = pd.DataFrame(columns=['classifier', 'precision'])     for clf in classifiers:          predicted = clf.predict(X_test)         precision = precision_score(y_test, predicted, average='macro')         classifier = clf.__class__.__name__         classifier = classifier.replace('Classifier', '')         result = result.append({'classifier': classifier, 'precision': precision}, ignore_index=True)         print('Precision is {precision} for {classifier_name}'.format(precision=round(precision,2), classifier_name=classifier))      result = result.sort_values(['classifier'], ascending=True)     plt.subplots(figsize=(10, 7))     sns.barplot(x=\"classifier\", y='precision', palette=cmap, data=result) calculate_precision(X_train, y_train)<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hr\/mk\/qd\/hrmkqdjyxnkbmj1llssq0coispi.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0440\u0438\u0441\u0443\u043d\u043a\u0430, \u0432\u044b\u0448\u043b\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e: \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c KNeighbors \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0438\u0436\u0435 \u0432\u0441\u0435\u0445, \u0438\u0431\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 TP \u0443 \u043d\u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0435 \u043c\u0435\u043d\u044c\u0448\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0442\u043e\u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0435\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/company\/ods\/blog\/328372\/\">\u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u0445, \u0438 \u0442\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u044c \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u0443\u044e \u0442\u0435\u043c\u0443 \u043f\u043e\u0433\u043b\u0443\u0431\u0436\u0435, \u0441\u0442\u043e\u0438\u0442 \u0441 \u043d\u0435\u0439 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"podbor-giper-parametrov\">\u041f\u043e\u0434\u0431\u043e\u0440 \u0433\u0438\u043f\u0435\u0440-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0443, \u0447\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c (\u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e FP), \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443: \u0412 \u0447\u0435\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 KNeighbors?<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0434\u0430\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c. \u0418, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043a \u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u043c\u043d\u043e\u0433\u0438\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0432\u043e\u0441\u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c: \u0437\u0430\u0447\u0435\u043c \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043d\u0430 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0445 \u043f\u0430\u0440\u043c\u0435\u0442\u0440\u0430\u0445? \u0415\u0441\u0442\u044c \u0436\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u0431\u043e\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 GridSearchCV.<br \/>  \u0414\u0430, \u043e\u043d\u043e \u0442\u0430\u043a, \u0438 \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u043a \u043d\u0435\u043c\u0443, <\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u0443\u0431\u0435\u0440\u0435\u043c \u0431\u0430\u0439\u0435\u0441\u0441\u043e\u0432\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430. \u041e\u043d \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043e\u0434\u0438\u043d FP, \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0432\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0447\u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code>classifiers.remove(gnb)<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"podstroyka\">\u041f\u043e\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u0442\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code>parameters = {'SVC':{'kernel':('linear', 'rbf','poly'), 'C':[i for i in range(1,11)],'random_state': (random_state,)},               'KNeighbors':{'algorithm':('ball_tree', 'kd_tree'), 'n_neighbors':[i for i in range(2,20)]},              'LogisticRegression':{'penalty':('l1', 'l2'), 'C':[i for i in range(1,11)],'random_state': (random_state,)},              'RandomForest':{'n_estimators':[i for i in range(10,101,10)],'random_state': (random_state,)},              'MLP':{'activation':('relu','logistic'),'solver':('sgd','lbfgs'),'max_iter':(500,1000), 'hidden_layer_sizes':[(7,),(7,7)],'random_state': (random_state,)}}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0447\u0438\u0441\u043b\u043e \u0441\u043b\u043e\u0435\u0432\/\u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0432 MLP.<br \/>  \u0420\u0435\u0448\u0435\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0435 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0430 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/stats.stackexchange.com\/a\/136542\">\u0444\u043e\u0440\u043c\u0443\u043b\u0435<\/a>:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/520\/ba8\/752\/520ba87528c81d7be92d54f412e94244.svg\" alt=\"$N_h = \\frac{N_s} {(\\alpha * (N_i + N_o))} = \\frac{117} {(2 * (7 + 1))} \\approx 7$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443, \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u043a\u0440\u043e\u0441\u0441-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435. \u042f \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0430 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0432 <a href=\"http:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.model_selection.GridSearchCV.html\">\u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a> \u0441 Iris Dataset. \u041d\u043e, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043d\u0430 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0443\u044e \u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code>from sklearn.model_selection import GridSearchCV warnings.filterwarnings('ignore') for idx,clf in enumerate(classifiers):     classifier = clf.__class__.__name__     classifier = classifier.replace('Classifier', '')     params = parameters.get(classifier)     if not params:         continue      new_clf = clf.__class__()     gs = GridSearchCV(new_clf, params, cv=5)     result =gs.fit(X_train, y_train)     print(f'The best params for {classifier} are {result.best_params_}')     classifiers[idx] = result.best_estimator_<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hq\/1p\/qy\/hq1pqyknfjzkh7zuauj_to-mylg.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 GridSearchCV, \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u043e\u0434\u0432\u0435\u0441\u0442\u0438 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0447\u0435\u0440\u0442\u0443.<\/p>\n<p>  <\/p>\n<h2 id=\"podvodim-itogi\">\u041f\u043e\u0434\u0432\u043e\u0434\u0438\u043c \u0438\u0442\u043e\u0433\u0438<\/h2>\n<p>  <\/p>\n<h3 id=\"matrica-oshibok-v2\">\u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043e\u0448\u0438\u0431\u043e\u043a v.2<\/h3>\n<p>  <\/p>\n<pre><code>matrices = make_confussion_matrices(X_train,y_train) draw_confussion_matrices(1,2,first_row,figsize = (10.5,6)) draw_confussion_matrices(1,3,second_row,figsize = (16,6))<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bp\/-i\/gb\/bp-igb2cyu26v-klambsbv8squk.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7j\/lv\/_b\/7jlv_btrr-2vb4jxjd3qxp0robk.png\"><br \/>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, MLP \u043f\u0440\u043e\u044f\u0432\u0438\u043b \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044e \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b \u0447\u0442\u043e \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043d\u0435\u0442 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u044b\u0445. Random Forest \u0434\u043e\u0431\u0440\u0430\u043b \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e False Negative \u0438 True Positive. \u0410 KNeighbors \u043f\u0440\u043e\u044f\u0432\u0438\u043b \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0438. \u041f\u0440\u043e\u0433\u043d\u043e\u0437 \u043f\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f.<\/p>\n<p>  <\/p>\n<h3 id=\"tochnost-v2\">\u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c v.2<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0448\u0438\u0431\u043e\u043a \u0441 False Positive, \u0447\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c. \u041d\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0441\u0451 \u044f\u0437\u044b\u043a\u043e\u043c \u0446\u0438\u0444\u0440, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443:<\/p>\n<p>  <\/p>\n<pre><code>calculate_precision(X_train, y_train) <\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nk\/9i\/14\/nk9i14ik-o-pvnlombnb8msikc8.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lg\/ze\/te\/lgzetelx1fyb3xz3wgfo3ako1m8.png\"><\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u044f\u0432\u043b\u0435\u043d\u043e 3 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0441 \u0441\u0430\u043c\u044b\u043c \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c Precision. \u0418 \u0443 \u043d\u0438\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0448\u0438\u0431\u043e\u043a. \u041a\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0432\u044b\u0431\u0440\u0430\u0442\u044c?<\/p>\n<p>  <\/p>\n<h3 id=\"kto-zhe-luchshe\">\u041a\u0442\u043e \u0436\u0435 \u043b\u0443\u0447\u0448\u0435?<\/h3>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0430\u0441\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043c\u043e\u044f \u0442\u043e\u0447\u043a\u0430 \u0437\u0440\u0435\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0431\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p>1.\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0422\u043e\u0433\u0434\u0430 \u0443 \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0438\u0441\u043a \u043f\u0435\u0440\u0435\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (\u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u044d\u0442\u043e \u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0441 MLP). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u043d\u0435 Random Forest, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043d\u0441\u0430\u043c\u0431\u043b\u0435\u043c 30 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043d\u0438\u0445. \u0421\u043e\u0437\u0432\u0443\u0447\u043d\u043e \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0438\u0434\u0435\u0439 Python Zen: \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0435.<\/p>\n<p>  <\/p>\n<p>2.\u041d\u0435\u043f\u043b\u043e\u0445\u043e, \u043a\u043e\u0433\u0434\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u044b\u043b \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d. \u0422\u043e \u0435\u0441\u0442\u044c KNeighbors \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c SVM c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e\u043c.<br \/>  \u0427\u0442\u043e \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435 \u0432\u044b\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043d\u0438\u0435: \u044f\u0432\u043d\u043e\u0435 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u043d\u0435\u044f\u0432\u043d\u043e\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 KNeighbors \u0441 3 \u0441\u043e\u0441\u0435\u0434\u044f\u043c\u0438, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043b\u0443\u0447\u0448\u0438\u0439 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0446 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Enron Dataset \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0437\u0430\u0434\u0430\u0447\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u0437\u044f\u0442\u044b \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0438\u0437 \u043a\u0443\u0440\u0441\u0430 Introduction to Machine Learning \u043d\u0430 Udacity. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c <a href=\"https:\/\/github.com\/VeeSot\/Enron-Fraud-Identify\/blob\/master\/enron.ipynb\">python notebook<\/a>, \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0432\u0441\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/425607\/\"> https:\/\/habr.com\/post\/425607\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u044b\u0445 \u0432 \u043c\u043e\u0448\u0435\u043d\u0438\u043d\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 Enron Dataset. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/habr.com\/post\/424891\/\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043f\u0440\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0430\u0441\u0442 \u043e\u0442\u0432\u0435\u0442: \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0432 \u043c\u043e\u0448\u0435\u043d\u0438\u0447\u0435\u0441\u0442\u0432\u0435?<\/p>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hn\/gs\/0i\/hngs0ix8h0znhrykvqefaqfdcey.png\" alt=\"Enron\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-290428","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=290428"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290428\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=290428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=290428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=290428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}