

{"id":111111,"date":"2022-12-29T10:00:40","date_gmt":"2022-12-29T04:30:40","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=111111"},"modified":"2022-12-29T10:56:35","modified_gmt":"2022-12-29T05:26:35","slug":"logistic-regression-with-pytorch","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/","title":{"rendered":"Logistic Regression with Pytorch"},"content":{"rendered":"<p>Logistic Regression is a Classification algorithm employed when only two possible outcomes exist. The applications having binary possibilities include spam detection, cancer tumour detection, fraudulent transaction detection etc. Let us learn about Logistic Regression with Pytorch.<\/p>\n<h3>Why Not Linear Regression?<\/h3>\n<p>Linear Regression tries to fit a straight line to the training dataset. However, to tackle classification problems, we can consider fitting a line that would divide the dataset into two sets to achieve the goal.<\/p>\n<p>However, this is inaccurate because even though we fit a line to the training dataset, it can be skewed just by adding one sample misclassifying the previously fitted samples.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/image13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111264\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/image13.png\" alt=\"image13\" width=\"451\" height=\"317\" \/><\/a><\/p>\n<p>In the above image, it is clear that we were able to classify the training samples using linear regression with minimum error (black line), but when we added one more point, many of the samples were misclassified (yellow line). Therefore, we can see that linear regression does not work well for classification problems.<\/p>\n<h3>Pytorch Logistic Regression Basics<\/h3>\n<p>Logistic Regression computes the probability of the sample being in the two categories and classifies it as belonging to the category with more probability. The hypothesis function is defined as h\u04e8(x), a probability of the sample belonging to class y=1.<\/p>\n<p><span style=\"font-weight: 400\">if <\/span><span style=\"font-weight: 400\">h<\/span><span style=\"font-weight: 400\">\u04e8<\/span><span style=\"font-weight: 400\">&gt;=0.5\u00a0 , \u00a0 y=1<\/span><\/p>\n<p><span style=\"font-weight: 400\">And <\/span><span style=\"font-weight: 400\">if <\/span><span style=\"font-weight: 400\">h<\/span><span style=\"font-weight: 400\">\u04e8<\/span><span style=\"font-weight: 400\">&lt;0.5, y=0<\/span><\/p>\n<p><span style=\"font-weight: 400\">h<\/span><span style=\"font-weight: 400\">\u04e8<\/span><span style=\"font-weight: 400\"> is calculated as follows,<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/equation.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-111266 alignleft\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/equation.png\" alt=\"equation\" width=\"116\" height=\"33\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">, where X is the feature matrix of the input dataset.<\/span><\/p>\n<h3>Logistic Regression in Python<\/h3>\n<h4>a. Importing the required libraries<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"> \r\nfrom sklearn.datasets import make_blobs\r\nfrom sklearn.datasets import make_classification\r\nfrom matplotlib import pyplot as plt\r\nfrom sklearn.linear_model import LogisticRegression\r\nfrom sklearn.model_selection import train_test_split\r\nfrom sklearn.metrics import confusion_matrix\r\nimport pandas as pd\r\nimport numpy as np\r\n<\/pre>\n<h4>b. Building the dataset<\/h4>\n<p>We will create some random data for the purpose of the study and try to build a logistic regression model to predict the results of the classifier on the test dataset.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">x,y=make_blobs(n_samples=[200,200],random_state=2)<\/pre>\n<h4>c. Visualising the dataset<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"> \r\nx_train=x\r\ny_train=y.reshape([-1,1])\r\nplt.scatter(x[:,0],x[:,1],c=y)\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/visualising-dataset.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111257\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/visualising-dataset.webp\" alt=\"visualising dataset\" width=\"377\" height=\"248\" \/><\/a><\/p>\n<h4>d. Splitting the training and test data<\/h4>\n<p>To build a model, we need a training and test dataset. The model will be trained using the train dataset and then validated on the test dataset.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=1)\r\n<\/pre>\n<h4>e. Building the model<\/h4>\n<p>We create an instance of the Logistic Regression module of the sklearn library to initialise our model, followed by training it over the train dataset.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">log_reg = LogisticRegression()\r\nlog_reg.fit(x_train, y_train)\r\n<\/pre>\n<h4>f. Prediction on the test dataset<\/h4>\n<p>Finally, we make predictions on the test dataset and determine its correctness using a confusion matrix.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">pred=log_reg.predict(x_test)\r\n\r\ny_test\r\n<\/pre>\n<p><strong>Output<\/strong>:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/test.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111258\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/test.webp\" alt=\"test\" width=\"1920\" height=\"211\" \/><\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">pred\r\n<\/pre>\n<p><strong>Output<\/strong>:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/pred.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111260\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/pred.webp\" alt=\"pred\" width=\"1920\" height=\"211\" \/><\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">confusion_matrix(y_test, pred)\r\n<\/pre>\n<p><strong>Output<\/strong>&#8211;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/confusion-matrix.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111261\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/confusion-matrix.webp\" alt=\"confusion matrix\" width=\"1920\" height=\"137\" \/><\/a><\/p>\n<p>The confusion indicates that there are only true positives and true negatives in the predicted dataset, meaning that all the data are correctly classified.<\/p>\n<h3>Implementing Logistic Regression using PyTorch:<\/h3>\n<p>We can use PyTorch to build a logistic regression model.<\/p>\n<h4>\u00a0a. Importing the required libraries:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from sklearn.datasets import make_blobs\r\nimport torch\r\nimport torch.nn as nn\r\nimport numpy as np\r\nfrom matplotlib import pyplot as plt<\/pre>\n<h4>b. Building the dataset<\/h4>\n<p>We will create random samples with labels 1 or 0 and convert them to tensors.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">x,y=make_blobs(n_samples=[200,200],random_state=2)\r\nx_train=torch.from_numpy(x).type(torch.FloatTensor)\r\ny_train=torch.from_numpy(y).type(torch.FloatTensor).reshape([-1,1])\r\nplt.scatter(x[:,0],x[:,1],c=y)\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/building-dataset.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111262\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/building-dataset.webp\" alt=\"building dataset\" width=\"1920\" height=\"351\" \/><\/a><\/p>\n<h4>c.\u00a0Building our Logistic Regression Model<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class LogReg(nn.Module):\r\n    def __init__(self):\r\n    \tsuper(LogReg,self).__init__()\r\n    \tself.l1=nn.Linear(2,1)\r\n    \r\n    def forward(self,x):\r\n    \ty_pred=torch.sigmoid(self.l1(x))\r\n    \treturn y_pred\r\n    \r\nmodel=LogReg()\r\n<\/pre>\n<h4>d. Training the model<\/h4>\n<p>Now we will define the optimiser and the loss function.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">optimiser=torch.optim.SGD(model.parameters(),lr=0.01)\r\ncriterion=torch.nn.BCELoss()\r\n<\/pre>\n<p>Finally, we train our model by running 100 epochs.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">for epoch in range(100):\r\n    optimiser.zero_grad()\r\n    y_pred=model(x_train)\r\n    loss=criterion(y_pred,y_train)\r\n    loss.backward()\r\n    optimiser.step()\r\n<\/pre>\n<h4>e. Predicting using the model<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">y_prediction=model(x_train)\r\ny_pred[:5]\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Our prediction is a probability distribution. We need to convert it to 0s and 1s.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">y_prediction=np.where(y_prediction&gt;0.5,1,0)\r\ny_prediction[:5]\r\n<\/pre>\n<p><strong>Output\u2013<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/prediction-array.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111263\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/prediction-array.webp\" alt=\"prediction array\" width=\"1918\" height=\"128\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>PyTorch provides an efficient and convenient way to build a logistic regression model, which can be used for image datasets as the tensors in PyTorch makes our job easier.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Logistic Regression is a Classification algorithm employed when only two possible outcomes exist. The applications having binary possibilities include spam detection, cancer tumour detection, fraudulent transaction detection etc. Let us learn about Logistic Regression&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":111256,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26498],"tags":[27175],"class_list":["post-111111","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pytorch-tutorials","tag-logistic-regression-with-pytorch"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Logistic Regression with Pytorch - DataFlair<\/title>\n<meta name=\"description\" content=\"PyTorch provides an efficient and convenient way to build a logistic regression model, which can be used for image datasets. Learn more.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Logistic Regression with Pytorch - DataFlair\" \/>\n<meta property=\"og:description\" content=\"PyTorch provides an efficient and convenient way to build a logistic regression model, which can be used for image datasets. Learn more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-29T04:30:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-29T05:26:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/pytorch-logistic-regression.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Logistic Regression with Pytorch - DataFlair","description":"PyTorch provides an efficient and convenient way to build a logistic regression model, which can be used for image datasets. Learn more.","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:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/","og_locale":"en_US","og_type":"article","og_title":"Logistic Regression with Pytorch - DataFlair","og_description":"PyTorch provides an efficient and convenient way to build a logistic regression model, which can be used for image datasets. Learn more.","og_url":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2022-12-29T04:30:40+00:00","article_modified_time":"2022-12-29T05:26:35+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/pytorch-logistic-regression.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Logistic Regression with Pytorch","datePublished":"2022-12-29T04:30:40+00:00","dateModified":"2022-12-29T05:26:35+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/"},"wordCount":509,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/pytorch-logistic-regression.webp","keywords":["Logistic Regression with Pytorch"],"articleSection":["PyTorch Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/","url":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/","name":"Logistic Regression with Pytorch - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/pytorch-logistic-regression.webp","datePublished":"2022-12-29T04:30:40+00:00","dateModified":"2022-12-29T05:26:35+00:00","description":"PyTorch provides an efficient and convenient way to build a logistic regression model, which can be used for image datasets. Learn more.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/pytorch-logistic-regression.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/12\/pytorch-logistic-regression.webp","width":1200,"height":628,"caption":"pytorch logistic regression"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/logistic-regression-with-pytorch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"PyTorch Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/pytorch-tutorials\/"},{"@type":"ListItem","position":3,"name":"Logistic Regression with Pytorch"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=111111"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111111\/revisions"}],"predecessor-version":[{"id":111268,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111111\/revisions\/111268"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/111256"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=111111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=111111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=111111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}