{"id":6911,"date":"2023-07-24T15:47:34","date_gmt":"2023-07-24T23:47:34","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=6911"},"modified":"2025-04-24T17:15:08","modified_gmt":"2025-04-24T17:15:08","slug":"introduction-to-machine-learning-model-evaluation","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/","title":{"rendered":"Introduction to Machine Learning Model Evaluation"},"content":{"rendered":"\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\">\n\n\n\n<div class=\"fh fi fj fk fl\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg lz ma c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:2000\/1*MPjZ1Lu2LCiMuYlMRxuOGQ.jpeg\" alt=\"\" width=\"2000\" height=\"1333\"><\/figure><div class=\"lt bg\">\n<figure class=\"lu lv lw lx ly lt bg paragraph-image\"><picture><\/picture><\/figure>\n<\/div>\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<p id=\"50f6\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">Machine learning continues to be an increasingly integral component of our lives, whether we\u2019re applying the techniques to research or business problems. Machine learning models ought to be able to give accurate predictions in order to create real value for a given organization.<\/p>\n<p id=\"23de\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">While <a class=\"af my\" href=\"https:\/\/medium.com\/r?url=https%3A%2F%2Fheartbeat.fritz.ai%2Ftraining-an-image-classification-convolutional-neural-net-to-detect-plant-disease-using-fast-ai-a9f5315ed59\" rel=\"noopener\">training a model<\/a> is a key step, how the model generalizes on unseen data is an equally important aspect that should be considered in every machine learning pipeline. We need to know whether it actually works and, consequently, if we can trust its predictions. Could the model be merely memorizing the data it is fed with, and therefore unable to make good predictions on future samples, or samples that it hasn\u2019t seen before?<\/p>\n<p id=\"8c15\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">In this article, we explain the techniques used in evaluating how well a machine learning model generalizes to new, previously unseen data. We\u2019ll also illustrate how common model evaluation metrics are implemented for classification and <a class=\"af my\" href=\"https:\/\/heartbeat.comet.ml\/5-regression-loss-functions-all-machine-learners-should-know-4fb140e9d4b0\" target=\"_blank\" rel=\"noopener ugc nofollow\">regression problems<\/a> using Python.<\/p>\n<h1 id=\"4fce\" class=\"mz na fo be nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt nu nv nw bj\" data-selectable-paragraph=\"\">Model Evaluation Techniques<\/h1>\n<p id=\"d5a2\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">The above issues can be handled by evaluating the performance of a machine learning model, which is an integral component of any data science project. Model evaluation aims to estimate the generalization accuracy of a model on future (unseen\/out-of-sample) data.<\/p>\n<p id=\"f17a\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">Methods for evaluating a model\u2019s performance are divided into 2 categories: namely, <a class=\"af my\" href=\"https:\/\/www.datarobot.com\/wiki\/training-validation-holdout\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">holdout<\/a> and <a class=\"af my\" href=\"https:\/\/towardsdatascience.com\/cross-validation-70289113a072\" target=\"_blank\" rel=\"noopener\">Cross-validation<\/a>. Both methods use a test set (i.e data not seen by the model) to evaluate model performance. It\u2019s not recommended to use the data we used to build the model to evaluate it. This is because our model will simply remember the whole training set, and will therefore always predict the correct label for any point in the training set. This is known as <a class=\"af my\" href=\"https:\/\/elitedatascience.com\/overfitting-in-machine-learning\" target=\"_blank\" rel=\"noopener ugc nofollow\">overfitting<\/a>.<\/p>\n<h2 id=\"88e2\" class=\"oc na fo be nb od oe of nf og oh oi nj ml oj ok ol mp om on oo mt op oq or os bj\" data-selectable-paragraph=\"\">Holdout<\/h2>\n<p id=\"4d5d\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">The purpose of holdout evaluation is to test a model on different data than it was trained on. This provides an unbiased estimate of learning performance.<\/p>\n<p id=\"d5a8\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">In this method, the dataset is <em class=\"ot\">randomly<\/em> divided into three subsets:<\/p>\n<ol class=\"\">\n<li id=\"dc38\" class=\"mb mc fo be b md me mf mg mh mi mj mk ou mm mn mo ov mq mr ms ow mu mv mw mx ox oy oz bj\" data-selectable-paragraph=\"\"><strong class=\"be pa\">Training set<\/strong> is a subset of the dataset used to build predictive models.<\/li>\n<li id=\"694b\" class=\"mb mc fo be b md pb mf mg mh pc mj mk ou pd mn mo ov pe mr ms ow pf mv mw mx ox oy oz bj\" data-selectable-paragraph=\"\"><strong class=\"be pa\">Validation set<\/strong> is a subset of the dataset used to assess the performance of the model built in the training phase. It provides a test platform for fine-tuning a model\u2019s parameters and selecting the best performing model. Not all modeling algorithms need a validation set.<\/li>\n<li id=\"cd0b\" class=\"mb mc fo be b md pb mf mg mh pc mj mk ou pd mn mo ov pe mr ms ow pf mv mw mx ox oy oz bj\" data-selectable-paragraph=\"\"><strong class=\"be pa\">Test set<\/strong>, or unseen data, is a subset of the dataset used to assess the likely future performance of a model. If a model fits to the training set much better than it fits the test set, overfitting is probably the cause.<\/li>\n<\/ol>\n<p id=\"1bf9\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">The holdout approach is useful because of its speed, simplicity, and flexibility. However, this technique is often associated with high variability since differences in the training and test dataset can result in meaningful differences in the estimate of accuracy.<\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"fh fi fj fk fl\">\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<h2 id=\"aa0f\" class=\"oc na fo be nb od oe of nf og oh oi nj ml oj ok ol mp om on oo mt op oq or os bj\" data-selectable-paragraph=\"\">Cross-Validation<\/h2>\n<p id=\"9aab\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\"><a class=\"af my\" href=\"https:\/\/machinelearningmastery.com\/k-fold-cross-validation\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Cross-validation<\/a> is a technique that involves partitioning the original observation dataset into a training set, used to train the model, and an independent set used to evaluate the analysis.<\/p>\n<p id=\"6e35\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">The most common cross-validation technique is <a class=\"af my\" href=\"https:\/\/medium.com\/datadriveninvestor\/k-fold-cross-validation-6b8518070833\" rel=\"noopener\">k-fold cross-validation<\/a>, where the original dataset is partitioned into k equal size subsamples, called folds. The k is a user-specified number, usually with 5 or 10 as its preferred value. This is repeated k times, such that each time, one of the k subsets is used as the test set\/validation set and the other k-1 subsets are put together to form a training set. The error estimation is averaged over all k trials to get the total effectiveness of our model.<\/p>\n<p id=\"a0e4\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">For instance, when performing five-fold cross-validation, the data is first partitioned into 5 parts of (approximately) equal size. A sequence of models is trained. The first model is trained using the first fold as the test set, and the remaining folds are used as the training set. This is repeated for each of these 5 splits of the data and the estimation of accuracy is averaged over all 5 trials to get the total effectiveness of our model.<\/p>\n<p id=\"a91c\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">As can be seen, every data point gets to be in a test set exactly once and gets to be in a training set k-1 times. This significantly reduces bias, as we\u2019re using most of the data for fitting, and it also significantly reduces variance, as most of the data is also being used in the test set. Interchanging the training and test sets also adds to the effectiveness of this method.<\/p>\n<h1 id=\"083f\" class=\"mz na fo be nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt nu nv nw bj\" data-selectable-paragraph=\"\">Model Evaluation Metrics<\/h1>\n<p id=\"e90d\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">Model evaluation metrics are required to quantify model performance. The choice of evaluation metrics depends on a given machine learning task (such as classification, regression, ranking, clustering, topic modeling, among others). Some metrics, such as <a class=\"af my\" href=\"https:\/\/towardsdatascience.com\/beyond-accuracy-precision-and-recall-3da06bea9f6c\" target=\"_blank\" rel=\"noopener\">precision-recall<\/a>, are useful for multiple tasks. Supervised learning tasks such as classification and regression constitutes a majority of machine learning applications. In this article, we focus on metrics for these two supervised learning models.<\/p>\n<h1 id=\"599c\" class=\"mz na fo be nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt nu nv nw bj\" data-selectable-paragraph=\"\">Classification Metrics<\/h1>\n<p id=\"e51e\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">In this section we will review some of the metrics used in classification problems, namely:<\/p>\n<ul class=\"\">\n<li id=\"6da6\" class=\"mb mc fo be b md me mf mg mh mi mj mk ou mm mn mo ov mq mr ms ow mu mv mw mx py oy oz bj\" data-selectable-paragraph=\"\">Classification Accuracy<\/li>\n<li id=\"6236\" class=\"mb mc fo be b md pb mf mg mh pc mj mk ou pd mn mo ov pe mr ms ow pf mv mw mx py oy oz bj\" data-selectable-paragraph=\"\">Confusion matrix<\/li>\n<li id=\"a8b6\" class=\"mb mc fo be b md pb mf mg mh pc mj mk ou pd mn mo ov pe mr ms ow pf mv mw mx py oy oz bj\" data-selectable-paragraph=\"\">Logarithmic Loss<\/li>\n<li id=\"b969\" class=\"mb mc fo be b md pb mf mg mh pc mj mk ou pd mn mo ov pe mr ms ow pf mv mw mx py oy oz bj\" data-selectable-paragraph=\"\">Area under curve (AUC)<\/li>\n<li id=\"bc34\" class=\"mb mc fo be b md pb mf mg mh pc mj mk ou pd mn mo ov pe mr ms ow pf mv mw mx py oy oz bj\" data-selectable-paragraph=\"\">F-Measure<\/li>\n<\/ul>\n<h2 id=\"193e\" class=\"oc na fo be nb od oe of nf og oh oi nj ml oj ok ol mp om on oo mt op oq or os bj\" data-selectable-paragraph=\"\">Classification Accuracy<\/h2>\n<p id=\"5215\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">Accuracy is a common evaluation metric for classification problems. It\u2019s the number of correct predictions made as a ratio of all predictions made. We use sklearn module to compute the accuracy of a classification task, as shown below:<\/p>\n<pre>#import modules\nimport warnings\nimport pandas as pd\nimport numpy as np\nfrom sklearn import model_selection\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn import datasets\nfrom sklearn.metrics import accuracy_score\n#ignore warnings\nwarnings.filterwarnings('ignore')\n# Load digits dataset\niris = datasets.load_iris()\n# # Create feature matrix\nX = iris.data\n# Create target vector\ny = iris.target\n#test size\ntest_size = 0.33\n#generate the same set of random numbers\nseed = 7\n#cross-validation settings\nkfold = model_selection.KFold(n_splits=10, random_state=seed)\n#Model instance\nmodel = LogisticRegression()\n#Evaluate model performance\nscoring = 'accuracy'\nresults = model_selection.cross_val_score(model, X, y, cv=kfold, scoring=scoring)\nprint('Accuracy -val set: %.2f%% (%.2f)' % (results.mean()*100, results.std()))\n\n#split data\nX_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=test_size, random_state=seed)\n#fit model\nmodel.fit(X_train, y_train)\n#accuracy on test set\nresult = model.score(X_test, y_test)\nprint(\"Accuracy - test set: %.2f%%\" % (result*100.0))<\/pre>\n<p id=\"59dc\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">The classification accuracy is <strong class=\"be pa\">88%<\/strong> on the validation set.<\/p>\n<p id=\"f7c9\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">By using cross-validation, we\u2019d be \u201ctesting\u201d our machine learning model in the \u201ctraining\u201d phase to check for overfitting and to get an idea about how our machine learning model will generalize to independent data (test data set).<\/p>\n<p id=\"975b\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">Cross-validation techniques can also be used to compare the performance of different machine learning models on the same data set and can also be helpful in selecting the values for a model\u2019s parameters that maximize the accuracy of the model\u2014also known as parameter tuning.<\/p>\n<h2 id=\"7d73\" class=\"oc na fo be nb od oe of nf og oh oi nj ml oj ok ol mp om on oo mt op oq or os bj\" data-selectable-paragraph=\"\">Confusion Matrix<\/h2>\n<p id=\"f109\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">A confusion matrix provides a more detailed breakdown of correct and incorrect classifications for each class. We use the <a class=\"af my\" href=\"http:\/\/archive.ics.uci.edu\/ml\/datasets\/iris\" target=\"_blank\" rel=\"noopener ugc nofollow\">Iris dataset<\/a> to classify and compute the confusion matrix for the predictions:<\/p>\n<pre>#import modules\nimport warnings\nimport pandas as pd\nfrom sklearn import model_selection\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import confusion_matrix\nimport matplotlib.pyplot as plt\n%matplotlib inline\n\n#ignore warnings\nwarnings.filterwarnings('ignore')\n# Load digits dataset\nurl = \"http:\/\/archive.ics.uci.edu\/ml\/machine-learning-databases\/iris\/iris.data\"\ndf = pd.read_csv(url)\n# df = df.values\nX = df.iloc[:,0:4]\ny = df.iloc[:,4]\n# print (y.unique())\n#test size\ntest_size = 0.33\n#generate the same set of random numbers\nseed = 7\n#Split data into train and test set.\nX_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=test_size, random_state=seed)\n#Train Model\nmodel = LogisticRegression()\nmodel.fit(X_train, y_train)\npred = model.predict(X_test)\n\n#Construct the Confusion Matrix\nlabels = ['Iris-setosa', 'Iris-versicolor', 'Iris-virginica']\ncm = confusion_matrix(y_test, pred, labels)\nprint(cm)\nfig = plt.figure()\nax = fig.add_subplot(111)\ncax = ax.matshow(cm)\nplt.title('Confusion matrix of the classifier')\nfig.colorbar(cax)\nax.set_xticklabels([''] + labels)\nax.set_yticklabels([''] + labels)\nplt.xlabel('Predicted')\nplt.ylabel('True')\nplt.show()<\/pre>\n<figure class=\"pz qa qb qc qd lt qh qi paragraph-image\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg lz ma c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:410\/1*3m5Cjkc5-drL8KrVvtnmCw.png\" alt=\"\" width=\"410\" height=\"333\"><\/figure><div class=\"qh qi qj\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*3m5Cjkc5-drL8KrVvtnmCw.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*3m5Cjkc5-drL8KrVvtnmCw.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*3m5Cjkc5-drL8KrVvtnmCw.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*3m5Cjkc5-drL8KrVvtnmCw.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*3m5Cjkc5-drL8KrVvtnmCw.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*3m5Cjkc5-drL8KrVvtnmCw.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:820\/format:webp\/1*3m5Cjkc5-drL8KrVvtnmCw.png 820w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 410px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*3m5Cjkc5-drL8KrVvtnmCw.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*3m5Cjkc5-drL8KrVvtnmCw.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*3m5Cjkc5-drL8KrVvtnmCw.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*3m5Cjkc5-drL8KrVvtnmCw.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*3m5Cjkc5-drL8KrVvtnmCw.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*3m5Cjkc5-drL8KrVvtnmCw.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:820\/1*3m5Cjkc5-drL8KrVvtnmCw.png 820w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 410px\" data-testid=\"og\"><\/picture><\/div>\n<\/figure>\n<p id=\"7a27\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">The short explanation of how to interpret a confusion matrix is as follows: The diagonal elements represent the number of points for which the predicted label is equal to the true label, while anything off the diagonal was mislabeled by the classifier. Therefore, the higher the diagonal values of the confusion matrix the better, indicating many correct predictions.<\/p>\n<p id=\"50c5\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">In our case, the classifier predicted all the 13 setosa and 18 virginica plants in the test data perfectly. However, it incorrectly classified 4 of the versicolor plants as virginica.<\/p>\n<h2 id=\"2121\" class=\"oc na fo be nb od oe of nf og oh oi nj ml oj ok ol mp om on oo mt op oq or os bj\" data-selectable-paragraph=\"\">Logarithmic Loss<\/h2>\n<p id=\"3886\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">Logarithmic loss (logloss) measures the performance of a classification model where the prediction input is a probability value between 0 and 1. Log loss increases as the predicted probability diverges from the actual label. The goal of machine learning models is to minimize this value. As such, smaller logloss is better, with a perfect model having a log loss of 0.<\/p>\n<pre>#Classification LogLoss\nimport warnings\nimport pandas\nfrom sklearn import model_selection\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import log_loss\n\nwarnings.filterwarnings('ignore')\nurl = \"https:\/\/raw.githubusercontent.com\/jbrownlee\/Datasets\/master\/pima-indians-diabetes.data.csv\"\ndataframe = pandas.read_csv(url)\ndat = dataframe.values\nX = dat[:,:-1]\ny = dat[:,-1]\nseed = 7\n#split data\nX_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=test_size, random_state=seed)\nmodel.fit(X_train, y_train)\n#predict and compute logloss\npred = model.predict(X_test)\naccuracy = log_loss(y_test, pred)\nprint(\"Logloss: %.2f\" % (accuracy))<\/pre>\n<h2 id=\"dbe1\" class=\"oc na fo be nb od oe of nf og oh oi nj ml oj ok ol mp om on oo mt op oq or os bj\" data-selectable-paragraph=\"\">Area under Curve (AUC)<\/h2>\n<p id=\"6447\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">Area under ROC Curve is a performance metric for measuring the ability of a <a class=\"af my\" href=\"https:\/\/heartbeat.comet.ml\/binary-classification-using-keras-in-r-ef3d42202aaa\" target=\"_blank\" rel=\"noopener ugc nofollow\">binary classifier <\/a>to discriminate between positive and negative classes.<\/p>\n<pre>#Classification Area under curve\nimport warnings\nimport pandas\nfrom sklearn import model_selection\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import roc_auc_score, roc_curve\n\nwarnings.filterwarnings('ignore')\n\nurl = \"https:\/\/raw.githubusercontent.com\/jbrownlee\/Datasets\/master\/pima-indians-diabetes.data.csv\"\ndataframe = pandas.read_csv(url)\ndat = dataframe.values\nX = dat[:,:-1]\ny = dat[:,-1]\nseed = 7\n#split data\nX_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=test_size, random_state=seed)\nmodel.fit(X_train, y_train)\n\n# predict probabilities\nprobs = model.predict_proba(X_test)\n# keep probabilities for the positive outcome only\nprobs = probs[:, 1]\n\nauc = roc_auc_score(y_test, probs)\nprint('AUC - Test Set: %.2f%%' % (auc*100))\n\n# calculate roc curve\nfpr, tpr, thresholds = roc_curve(y_test, probs)\n# plot no skill\nplt.plot([0, 1], [0, 1], linestyle='--')\n# plot the roc curve for the model\nplt.plot(fpr, tpr, marker='.')\n# show the plot\nplt.show()<\/pre>\n<figure class=\"pz qa qb qc qd lt qh qi paragraph-image\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg lz ma c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:426\/1*L6KQRhvz1WT2L5MmRDRbAQ.png\" alt=\"\" width=\"426\" height=\"281\"><\/figure><div class=\"qh qi qk\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:852\/format:webp\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 852w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 426px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:852\/1*L6KQRhvz1WT2L5MmRDRbAQ.png 852w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 426px\" data-testid=\"og\"><\/picture><\/div>\n<\/figure>\n<p id=\"4ec0\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">In the example above, the AUC is relatively close to 1 and greater than 0.5. A perfect classifier will have the ROC curve go along the Y axis and then along the X axis.<\/p>\n<h2 id=\"6250\" class=\"oc na fo be nb od oe of nf og oh oi nj ml oj ok ol mp om on oo mt op oq or os bj\" data-selectable-paragraph=\"\">F-Measure<\/h2>\n<p id=\"bb7c\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">F-measure (also F-score) is a measure of a test\u2019s accuracy that considers both the <a class=\"af my\" href=\"https:\/\/en.wikipedia.org\/wiki\/Precision_(information_retrieval)\" target=\"_blank\" rel=\"noopener ugc nofollow\">precision<\/a> and the <a class=\"af my\" href=\"https:\/\/en.wikipedia.org\/wiki\/Recall_(information_retrieval)\" target=\"_blank\" rel=\"noopener ugc nofollow\">recall<\/a> of the test to compute the score. Precision is the number of correct positive results divided by the total predicted positive observations. Recall, on the other hand, is the number of correct positive results divided by the number of all relevant samples (total actual positives).<\/p>\n<pre>import warnings\nimport pandas\nfrom sklearn import model_selection\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import log_loss\nfrom sklearn.metrics import precision_recall_fscore_support as score, precision_score, recall_score, f1_score\n\nwarnings.filterwarnings('ignore')\n\nurl = \"https:\/\/raw.githubusercontent.com\/jbrownlee\/Datasets\/master\/pima-indians-diabetes.data.csv\"\ndataframe = pandas.read_csv(url)\ndat = dataframe.values\nX = dat[:,:-1]\ny = dat[:,-1]\ntest_size = 0.33\nseed = 7\n\nmodel = LogisticRegression()\n#split data\nX_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=test_size, random_state=seed)\nmodel.fit(X_train, y_train)\nprecision = precision_score(y_test, pred)\nprint('Precision: %f' % precision)\n# recall: tp \/ (tp + fn)\nrecall = recall_score(y_test, pred)\nprint('Recall: %f' % recall)\n# f1: tp \/ (tp + fp + fn)\nf1 = f1_score(y_test, pred)\nprint('F1 score: %f' % f1)<\/pre>\n<h1 id=\"2d7f\" class=\"mz na fo be nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt nu nv nw bj\" data-selectable-paragraph=\"\">Regression Metrics<\/h1>\n<p id=\"4a05\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">In this section we review 2 of the most common metrics for evaluating regression problems namely, Root Mean Squared Error and Mean Absolute Error.<\/p>\n<p id=\"e431\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">The Mean Absolute Error (or MAE) is the sum of the absolute differences between predictions and actual values. On the other hand, Root Mean Squared Error (RMSE) measures the average magnitude of the error by taking the square root of the average of squared differences between prediction and actual observation.<\/p>\n<p id=\"98d0\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">The Python code snippet below shows how the two regression metrics can be implemented.<\/p>\n<pre>import pandas\nfrom sklearn import model_selection\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.metrics import mean_absolute_error, mean_squared_error\nfrom math import sqrt\nurl = \"https:\/\/raw.githubusercontent.com\/jbrownlee\/Datasets\/master\/housing.data\"\ndataframe = pandas.read_csv(url, delim_whitespace=True)\ndf = dataframe.values\nX = df[:,:-1]\ny = df[:,-1]\nseed = 7\nmodel = LinearRegression()\n#split data\nX_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=test_size, random_state=seed)\nmodel.fit(X_train, y_train)\n#predict\npred = model.predict(X_test)\nprint(\"MAE test score:\", mean_absolute_error(y_test, pred))\nprint(\"RMSE test score:\", sqrt(mean_squared_error(y_test, pred)))<\/pre>\n<h1 id=\"97e0\" class=\"mz na fo be nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt nu nv nw bj\" data-selectable-paragraph=\"\">Conclusion<\/h1>\n<p id=\"0ec8\" class=\"pw-post-body-paragraph mb mc fo be b md nx mf mg mh ny mj mk ml nz mn mo mp oa mr ms mt ob mv mw mx fh bj\" data-selectable-paragraph=\"\">Ideally, the estimated performance of a model tells us how well it performs on unseen data. Making predictions on future data is often the main problem we want to solve. It\u2019s important to understand the context before choosing a metric because each machine learning model tries to solve a problem with a different objective using a different dataset.<\/p>\n<p id=\"f51e\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\">This article has attempted to explain the common evaluation metrics for classification and regression machine learning problems, providing short Python snippets to show how they can be implemented.<\/p>\n<p id=\"a0b6\" class=\"pw-post-body-paragraph mb mc fo be b md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx fh bj\" data-selectable-paragraph=\"\"><strong class=\"be pa\">Discuss this post on <\/strong><a class=\"af my\" href=\"https:\/\/news.ycombinator.com\/item?id=19674289\" target=\"_blank\" rel=\"noopener ugc nofollow\"><strong class=\"be pa\">Hacker News<\/strong><\/a><strong class=\"be pa\"> and <\/strong><a class=\"af my\" href=\"https:\/\/www.reddit.com\/r\/MachinesLearn\/comments\/bdv27q\/introduction_to_machine_learning_model_evaluation\/?ref=share&amp;ref_source=link\" target=\"_blank\" rel=\"noopener ugc nofollow\"><strong class=\"be pa\">Reddit<\/strong><\/a><strong class=\"be pa\">.<\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Machine learning continues to be an increasingly integral component of our lives, whether we\u2019re applying the techniques to research or business problems. Machine learning models ought to be able to give accurate predictions in order to create real value for a given organization. While training a model is a key step, how the model generalizes [&hellip;]<\/p>\n","protected":false},"author":58,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[6],"tags":[],"coauthors":[160],"class_list":["post-6911","post","type-post","status-publish","format-standard","hentry","category-machine-learning"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Introduction to Machine Learning Model Evaluation - Comet<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to Machine Learning Model Evaluation\" \/>\n<meta property=\"og:description\" content=\"Machine learning continues to be an increasingly integral component of our lives, whether we\u2019re applying the techniques to research or business problems. Machine learning models ought to be able to give accurate predictions in order to create real value for a given organization. While training a model is a key step, how the model generalizes [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-24T23:47:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T17:15:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/miro.medium.com\/v2\/resize:fit:2000\/1*MPjZ1Lu2LCiMuYlMRxuOGQ.jpeg\" \/>\n<meta name=\"author\" content=\"Steve Mutuvi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Cometml\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Steve Mutuvi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Introduction to Machine Learning Model Evaluation - Comet","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to Machine Learning Model Evaluation","og_description":"Machine learning continues to be an increasingly integral component of our lives, whether we\u2019re applying the techniques to research or business problems. Machine learning models ought to be able to give accurate predictions in order to create real value for a given organization. While training a model is a key step, how the model generalizes [&hellip;]","og_url":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2023-07-24T23:47:34+00:00","article_modified_time":"2025-04-24T17:15:08+00:00","og_image":[{"url":"https:\/\/miro.medium.com\/v2\/resize:fit:2000\/1*MPjZ1Lu2LCiMuYlMRxuOGQ.jpeg","type":"","width":"","height":""}],"author":"Steve Mutuvi","twitter_card":"summary_large_image","twitter_creator":"@Cometml","twitter_site":"@Cometml","twitter_misc":{"Written by":"Steve Mutuvi","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/"},"author":{"name":"Steve Mutuvi","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/639eae8fd42baddf6b20f2a53a1a01b4"},"headline":"Introduction to Machine Learning Model Evaluation","datePublished":"2023-07-24T23:47:34+00:00","dateModified":"2025-04-24T17:15:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/"},"wordCount":1453,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:2000\/1*MPjZ1Lu2LCiMuYlMRxuOGQ.jpeg","articleSection":["Machine Learning"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/","url":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/","name":"Introduction to Machine Learning Model Evaluation - Comet","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:2000\/1*MPjZ1Lu2LCiMuYlMRxuOGQ.jpeg","datePublished":"2023-07-24T23:47:34+00:00","dateModified":"2025-04-24T17:15:08+00:00","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/#primaryimage","url":"https:\/\/miro.medium.com\/v2\/resize:fit:2000\/1*MPjZ1Lu2LCiMuYlMRxuOGQ.jpeg","contentUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:2000\/1*MPjZ1Lu2LCiMuYlMRxuOGQ.jpeg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/introduction-to-machine-learning-model-evaluation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"Introduction to Machine Learning Model Evaluation"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/639eae8fd42baddf6b20f2a53a1a01b4","name":"Steve Mutuvi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/755d918fcab21a409c4ce563108d271c","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/1540036342151-96x96.jpg","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/1540036342151-96x96.jpg","caption":"Steve Mutuvi"},"url":"https:\/\/www.comet.com\/site\/blog\/author\/stevemutuvigmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/6911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/58"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=6911"}],"version-history":[{"count":1,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/6911\/revisions"}],"predecessor-version":[{"id":15599,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/6911\/revisions\/15599"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=6911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=6911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=6911"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=6911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}