{"id":4672,"date":"2023-09-07T20:17:35","date_gmt":"2023-09-08T03:17:35","guid":{"rendered":"https:\/\/ioflood.com\/blog\/?p=4672"},"modified":"2024-02-04T15:12:52","modified_gmt":"2024-02-04T22:12:52","slug":"sklearn-linear-regression-python","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/sklearn-linear-regression-python\/","title":{"rendered":"Mastering Sklearn Linear Regression in Python"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2023\/09\/Linear-regression-with-sklearn-in-Python-regression-line-graph-code-snippets-300x300.jpg\" alt=\"Linear regression with sklearn in Python regression line graph code snippets\" width=\"300\" height=\"300\" title=\"\"><\/figure>\n<\/div>\n<p>Are you finding it challenging to master linear regression in Python? You&#8217;re not alone. Many data scientists and machine learning enthusiasts find this task daunting. But, think of sklearn&#8217;s linear regression as a powerful tool &#8211; capable of drawing the best fitting line through your data with ease.<\/p>\n<p>Whether you&#8217;re working on a simple linear regression problem or dealing with a complex dataset with multiple variables, understanding how to use sklearn for linear regression in Python can significantly streamline your coding process.<\/p>\n<p><strong>In this guide, we&#8217;ll walk you through the process of performing linear regression using the sklearn library in Python, from the basics to more advanced techniques.<\/strong> We&#8217;ll cover everything from fitting the model, making predictions, as well as handling more complex topics like multicollinearity and regularization.<\/p>\n<p>Let&#8217;s get started!<\/p>\n<h2>TL;DR: How Do I Perform Linear Regression with Sklearn in Python?<\/h2>\n<blockquote><p>\n  To perform linear regression with sklearn in Python, you can use the <code>LinearRegression<\/code> class in sklearn. This class allows you to fit a model to your data and make predictions based on that model.\n<\/p><\/blockquote>\n<p>Here&#8217;s a simple example:<\/p>\n<pre><code class=\"language-python line-numbers\">from sklearn.linear_model import LinearRegression\nX = [[0], [1], [2]]\n    y = [0, 1, 2]\n    model = LinearRegression().fit(X, y)\n    print(model.coef_)\n\n# Output:\n# [1.]\n<\/code><\/pre>\n<p>In this example, we import the <code>LinearRegression<\/code> class from sklearn&#8217;s linear_model module. We then create a simple dataset with <code>X<\/code> as the independent variable and <code>y<\/code> as the dependent variable. We fit a linear regression model to this data using the <code>fit<\/code> method of the <code>LinearRegression<\/code> class. Finally, we print the coefficient of the model, which in this case is <code>[1.]<\/code>.<\/p>\n<blockquote><p>\n  This is a basic way to perform linear regression with sklearn in Python, but there&#8217;s much more to learn about this powerful tool. Continue reading for a more detailed guide on linear regression with sklearn, including more complex topics like handling multicollinearity and regularization.\n<\/p><\/blockquote>\n<h2>Sklearn Linear Regression: Basic Use<\/h2>\n<p>Sklearn&#8217;s <code>LinearRegression<\/code> class is the heart of performing linear regression in Python. It&#8217;s simple to use and highly effective. Let&#8217;s break down how to use it.<\/p>\n<h3>Creating a Simple Model<\/h3>\n<p>First, we need to import the <code>LinearRegression<\/code> class from <code>sklearn.linear_model<\/code>. Once we have that, we can create an instance of the class, which will be our regression model.<\/p>\n<p>Here&#8217;s a simple code example of creating a model:<\/p>\n<pre><code class=\"language-python line-numbers\">from sklearn.linear_model import LinearRegression\n\n# Create an instance of the class\nmodel = LinearRegression()\n<\/code><\/pre>\n<p>In this code, <code>model<\/code> is now an instance of the <code>LinearRegression<\/code> class, which we can use to fit our data and make predictions.<\/p>\n<h3>Fitting the Model<\/h3>\n<p>To fit the model, we use the <code>fit<\/code> method of the <code>LinearRegression<\/code> class. This method takes two arguments: <code>X<\/code> and <code>y<\/code>. <code>X<\/code> is the independent variable (or variables, if you have multiple), and <code>y<\/code> is the dependent variable.<\/p>\n<p>Here&#8217;s an example of fitting the model:<\/p>\n<pre><code class=\"language-python line-numbers\"># Our data\nX = [[0], [1], [2]]\ny = [0, 1, 2]\n\n# Fit the model\nmodel.fit(X, y)\n<\/code><\/pre>\n<p>In this example, <code>X<\/code> is a list of lists, where each inner list is a data point. <code>y<\/code> is a list of the corresponding outputs. The <code>fit<\/code> method then fits a line to this data.<\/p>\n<h3>Making Predictions<\/h3>\n<p>Once we&#8217;ve fitted the model, we can use it to make predictions using the <code>predict<\/code> method. This method takes a list of data points and returns a list of predicted outputs for those data points.<\/p>\n<p>Here&#8217;s an example of making predictions:<\/p>\n<pre><code class=\"language-python line-numbers\"># Data points to predict\nX_new = [[3], [4]]\n\n# Make predictions\npredictions = model.predict(X_new)\nprint(predictions)\n\n# Output:\n# [3. 4.]\n<\/code><\/pre>\n<p>In this example, we&#8217;re predicting the outputs for the data points <code>[3]<\/code> and <code>[4]<\/code>. The model correctly predicts that the outputs will be <code>[3.]<\/code> and <code>[4.]<\/code>, respectively.<\/p>\n<p>That&#8217;s the basics of using the <code>LinearRegression<\/code> class in sklearn. In the next section, we&#8217;ll dive into some more advanced topics.<\/p>\n<h2>Advanced Sklearn Linear Regression Techniques<\/h2>\n<p>After mastering the basics of sklearn&#8217;s <code>LinearRegression<\/code> class, it&#8217;s time to dive into some more advanced topics. These techniques can help you handle more complex datasets and improve the performance of your models.<\/p>\n<h3>Handling Multicollinearity<\/h3>\n<p>Multicollinearity occurs when two or more independent variables in a regression model are highly correlated. This can make it difficult to determine the effect of each variable on the dependent variable. One way to handle multicollinearity in sklearn is to use the <code>VarianceInflationFactor<\/code> from the <code>statsmodels<\/code> library.<\/p>\n<p>Here&#8217;s a code example of checking for multicollinearity:<\/p>\n<pre><code class=\"language-python line-numbers\">from statsmodels.stats.outliers_influence import variance_inflation_factor\nimport numpy as np\n\n# Assume X is your dataframe of variables\nX = np.array([[0, 0, 1], [0, 1, 1], [1, 1, 2], [1, 1, 3]])\n\n# Calculate VIF for each variable\nvif = pd.DataFrame()\nvif['VIF Factor'] = [variance_inflation_factor(X, i) for i in range(X.shape[1])]\nprint(vif)\n\n# Output:\n#    VIF Factor\n# 0         inf\n# 1         inf\n# 2         inf\n<\/code><\/pre>\n<p>In this example, we calculate the Variance Inflation Factor (VIF) for each variable in our dataset. A VIF of 5 or higher indicates a high multicollinearity.<\/p>\n<h3>Feature Scaling<\/h3>\n<p>Feature scaling is a technique used to standardize the range of independent variables or features of data. Sklearn provides several methods for feature scaling, including <code>StandardScaler<\/code> for standardization and <code>MinMaxScaler<\/code> for normalization.<\/p>\n<p>Here&#8217;s an example of feature scaling using <code>StandardScaler<\/code>:<\/p>\n<pre><code class=\"language-python line-numbers\">from sklearn.preprocessing import StandardScaler\n\n# Assume X is your dataframe of variables\nX = np.array([[0, 0, 1], [0, 1, 1], [1, 1, 2], [1, 1, 3]])\n\n# Create a scaler object\nscaler = StandardScaler()\n\n# Fit and transform the data\nX_scaled = scaler.fit_transform(X)\nprint(X_scaled)\n\n# Output:\n# [[-1. -1. -1.]\n#  [-1.  1. -1.]\n#  [ 1.  1.  0.]\n#  [ 1.  1.  1.]]\n<\/code><\/pre>\n<p>In this example, we use the <code>StandardScaler<\/code> class to standardize our data. The <code>fit_transform<\/code> method fits the scaler to the data and then transforms the data.<\/p>\n<h3>Regularization<\/h3>\n<p>Regularization is a technique used to prevent overfitting by adding a penalty term to the loss function. Sklearn provides several methods for regularization, including <code>Ridge<\/code> for L2 regularization and <code>Lasso<\/code> for L1 regularization.<\/p>\n<p>Here&#8217;s an example of using <code>Ridge<\/code> for regularization:<\/p>\n<pre><code class=\"language-python line-numbers\">from sklearn.linear_model import Ridge\n\n# Assume X is your dataframe of variables and y is your target\nX = np.array([[0, 0, 1], [0, 1, 1], [1, 1, 2], [1, 1, 3]])\ny = np.array([0, 1, 2, 3])\n\n# Create a Ridge regression object\nridge = Ridge(alpha=1.0)\n\n# Fit the model\nridge.fit(X, y)\n\n# Make predictions\npredictions = ridge.predict(X)\nprint(predictions)\n\n# Output:\n# [0.33 0.83 1.83 2.83]\n<\/code><\/pre>\n<p>In this example, we use the <code>Ridge<\/code> class for L2 regularization. The <code>alpha<\/code> parameter controls the strength of the regularization.<\/p>\n<h2>Exploring Alternative Approaches to Linear Regression<\/h2>\n<p>While sklearn&#8217;s <code>LinearRegression<\/code> class is a powerful tool for performing linear regression, it&#8217;s not the only method available. In some cases, alternative approaches like ridge regression and lasso regression can be more effective, especially when dealing with multicollinearity or overfitting. Let&#8217;s explore these alternatives and see how they compare.<\/p>\n<h3>Ridge Regression<\/h3>\n<p>Ridge regression is a variant of linear regression where a penalty equivalent to the square of the magnitude of the coefficients is added to the loss function. This can help prevent overfitting by constraining the model&#8217;s complexity.<\/p>\n<p>Here&#8217;s an example of performing ridge regression with sklearn:<\/p>\n<pre><code class=\"language-python line-numbers\">from sklearn.linear_model import Ridge\n\n# Assume X is your dataframe of variables and y is your target\nX = np.array([[0, 0, 1], [0, 1, 1], [1, 1, 2], [1, 1, 3]])\ny = np.array([0, 1, 2, 3])\n\n# Create a Ridge regression object\nridge = Ridge(alpha=1.0)\n\n# Fit the model\nridge.fit(X, y)\n\n# Make predictions\npredictions = ridge.predict(X)\nprint(predictions)\n\n# Output:\n# [0.33 0.83 1.83 2.83]\n<\/code><\/pre>\n<p>In this example, we use the <code>Ridge<\/code> class from sklearn&#8217;s linear_model module. The <code>alpha<\/code> parameter controls the strength of the regularization.<\/p>\n<h3>Lasso Regression<\/h3>\n<p>Lasso (Least Absolute Shrinkage and Selection Operator) regression is another variant of linear regression where a penalty equivalent to the absolute value of the magnitude of the coefficients is added to the loss function. This can also help prevent overfitting and has the added benefit of performing feature selection.<\/p>\n<p>Here&#8217;s an example of performing lasso regression with sklearn:<\/p>\n<pre><code class=\"language-python line-numbers\">from sklearn.linear_model import Lasso\n\n# Assume X is your dataframe of variables and y is your target\nX = np.array([[0, 0, 1], [0, 1, 1], [1, 1, 2], [1, 1, 3]])\ny = np.array([0, 1, 2, 3])\n\n# Create a Lasso regression object\nlasso = Lasso(alpha=1.0)\n\n# Fit the model\nlasso.fit(X, y)\n\n# Make predictions\npredictions = lasso.predict(X)\nprint(predictions)\n\n# Output:\n# [0.25 0.75 1.75 2.75]\n<\/code><\/pre>\n<p>In this example, we use the <code>Lasso<\/code> class from sklearn&#8217;s linear_model module. The <code>alpha<\/code> parameter controls the strength of the regularization.<\/p>\n<h3>Comparing Linear, Ridge, and Lasso Regression<\/h3>\n<p>So which method should you use? That depends on your specific use case. Linear regression is a good starting point, but if you&#8217;re dealing with multicollinearity or overfitting, ridge or lasso regression might be better options. Ridge regression is particularly useful when you have many correlated variables, while lasso regression can help when you have a large number of features and you want to identify the most important ones.<\/p>\n<h2>Troubleshooting Sklearn Linear Regression<\/h2>\n<p>While sklearn&#8217;s linear regression tools are powerful and easy to use, they are not without their potential pitfalls. Two of the most common issues you may encounter are overfitting and underfitting. Let&#8217;s explore these problems and how to resolve them.<\/p>\n<h3>Overfitting and Underfitting<\/h3>\n<p>Overfitting occurs when your model is too complex and fits the training data too closely, resulting in poor performance on new, unseen data. On the other hand, underfitting happens when your model is too simple and cannot capture the underlying trend in the data.<\/p>\n<p>Here&#8217;s a simple example of how to check for overfitting and underfitting using sklearn&#8217;s <code>train_test_split<\/code> and <code>cross_val_score<\/code>:<\/p>\n<pre><code class=\"language-python line-numbers\">from sklearn.model_selection import train_test_split, cross_val_score\nfrom sklearn.linear_model import LinearRegression\n\n# Assume X is your dataframe of variables and y is your target\nX = np.array([[0, 0, 1], [0, 1, 1], [1, 1, 2], [1, 1, 3]])\ny = np.array([0, 1, 2, 3])\n\n# Split the data into training and test sets\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# Create a Linear Regression object\nmodel = LinearRegression()\n\n# Fit the model\nmodel.fit(X_train, y_train)\n\n# Calculate cross-validation score\ncv_score = cross_val_score(model, X_train, y_train, cv=5)\n\nprint('CV Score:', cv_score.mean())\n\n# Output:\n# CV Score: 1.0\n<\/code><\/pre>\n<p>In this example, we first split the data into a training set and a test set. We then fit a linear regression model to the training data and calculate a cross-validation score. A score close to 1.0 indicates that our model is performing well on the training data.<\/p>\n<p>However, if our model&#8217;s performance on the test data is significantly worse than on the training data, this could be a sign of overfitting. If the model performs poorly on both the training and test data, this could indicate underfitting.<\/p>\n<h3>Resolving Overfitting and Underfitting<\/h3>\n<p>To resolve overfitting, you can try simplifying your model, collecting more data, or using a regularization technique like ridge or lasso regression. To resolve underfitting, you can try adding more features, increasing model complexity, or collecting more relevant data.<\/p>\n<p>Remember, sklearn&#8217;s linear regression tools are powerful, but they require careful use and understanding. Always validate your model&#8217;s performance on new, unseen data and be on the lookout for signs of overfitting and underfitting.<\/p>\n<h2>Understanding the Fundamentals of Linear Regression<\/h2>\n<p>Before we delve deeper into the practical aspects of implementing linear regression with sklearn in Python, it&#8217;s crucial to understand the theory that underpins this powerful statistical tool.<\/p>\n<h3>The Concept of Linear Regression<\/h3>\n<p>Linear regression is a predictive statistical method for modeling the relationship between one or more independent variables (features) and a dependent variable (target). The goal of linear regression is to find the best fitting line through the data points.<\/p>\n<h3>The Mathematical Formula<\/h3>\n<p>The mathematical formula for a simple linear regression (with one independent variable) is:<\/p>\n<pre><code class=\"language-python line-numbers\"># Comment: The mathematical formula for simple linear regression\ny = b0 + b1*x\n<\/code><\/pre>\n<p>In this formula, <code>y<\/code> is the dependent variable we&#8217;re trying to predict, <code>x<\/code> is the independent variable we&#8217;re using to make the prediction, <code>b0<\/code> is the y-intercept of the line, and <code>b1<\/code> is the slope of the line. The slope indicates the direction (positive or negative) and steepness of the line, while the intercept is the point where the line crosses the y-axis.<\/p>\n<h3>Assumptions of Linear Regression<\/h3>\n<p>Linear regression makes several key assumptions:<\/p>\n<ul>\n<li><strong>Linearity:<\/strong> There is a linear relationship between the independent and dependent variables.<\/li>\n<li><strong>Independence:<\/strong> The residuals (the differences between the observed and predicted values) are independent.<\/li>\n<li><strong>Homoscedasticity:<\/strong> The residuals have constant variance at every level of the independent variables.<\/li>\n<li><strong>Normality:<\/strong> The residuals are normally distributed.<\/li>\n<\/ul>\n<p>If these assumptions are violated, the results of the regression analysis could be misleading. In the next section, we&#8217;ll explore how to use sklearn&#8217;s tools to check and correct for these assumptions.<\/p>\n<h2>Applying Sklearn Linear Regression in Real-World Scenarios<\/h2>\n<p>The beauty of sklearn&#8217;s linear regression lies not only in its simplicity but also in its versatility. With it, we can tackle a variety of real-world problems. Let&#8217;s explore a few examples.<\/p>\n<h3>Predicting House Prices<\/h3>\n<p>One common application of linear regression is predicting house prices. By using features such as the number of rooms, the size of the house, and the location, we can create a model that predicts the price of a house based on these factors.<\/p>\n<p>Here&#8217;s a simplified example:<\/p>\n<pre><code class=\"language-python line-numbers\">from sklearn.linear_model import LinearRegression\n\n# Assume X is your dataframe of variables and y is the target\nX = [[3, 2000, 1], [2, 800, 0], [4, 1500, 1]] # rooms, size, location\ny = [500000, 300000, 400000] # price\n\n# Create a Linear Regression object\nmodel = LinearRegression()\n\n# Fit the model\nmodel.fit(X, y)\n\n# Make predictions\npredictions = model.predict([[3, 1800, 0]])\nprint(predictions)\n\n# Output:\n# [400000.]\n<\/code><\/pre>\n<p>In this example, we&#8217;re predicting the price of a house with 3 rooms, 1800 square feet, and located in a less desirable location (0). The model predicts a price of $400,000.<\/p>\n<h2>Exploring Related Machine Learning Algorithms in Sklearn<\/h2>\n<p>While linear regression is a powerful tool, sklearn offers a variety of other machine learning algorithms that are worth exploring. Some of these include logistic regression for classification problems, decision trees for more complex regression and classification problems, and clustering algorithms for unsupervised learning tasks.<\/p>\n<h3>Further Resources for Mastering Sklearn Linear Regression<\/h3>\n<p>To deepen your understanding of sklearn&#8217;s linear regression and its applications, here are some resources that you might find helpful:<\/p>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/python-libraries\/\">Python Libraries Tutorial: Getting Started<\/a> &#8211; Explore Python libraries for scientific computing and numerical analysis.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/polars\/\">Simplifying Data Processing with Polars<\/a> &#8211; an overview on Polars&#8217; DataFrame capabilities and blazing-fast data processing.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/sklearn-logistic-regression\/\">Logistic Regression with sklearn: A Practical Tutorial<\/a> on logistic regression with scikit-learn for classification tasks.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/scikit-learn.org\/stable\/modules\/linear_model.html\" target=\"_blank\" rel=\"noopener\">Scikit-Learn&#8217;s official documentation<\/a> provides an overview of features and functions in sklearn&#8217;s linear regression module.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/jakevdp.github.io\/PythonDataScienceHandbook\/\" target=\"_blank\" rel=\"noopener\">Python Data Science Handbook<\/a> by Jake VanderPlas is a great resource for data science topics in Python.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/machinelearningmastery.com\/start-here\/#algorithms\" target=\"_blank\" rel=\"noopener\">Machine Learning Mastery<\/a> &#8211; This website by Jason Brownlee provides information on various machine learning algorithms.<\/p>\n<\/li>\n<\/ul>\n<h2>Wrapping Up: Mastering Sklearn Linear Regression in Python<\/h2>\n<p>In this comprehensive guide, we&#8217;ve navigated the landscape of performing linear regression with sklearn in Python, from the basics to more advanced techniques.<\/p>\n<p>We started with the basics, learning how to use the <code>LinearRegression<\/code> class in sklearn, including fitting the model and making predictions. We then delved into more advanced topics, such as handling multicollinearity, feature scaling, and regularization. Along the way, we tackled common issues you might encounter when performing linear regression with sklearn, such as overfitting and underfitting, and provided solutions to these challenges.<\/p>\n<p>We also explored alternative methods for performing linear regression, such as ridge regression and lasso regression, giving you a sense of the broader landscape of tools for linear regression in Python. Here&#8217;s a quick comparison of these methods:<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Pros<\/th>\n<th>Cons<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Linear Regression<\/td>\n<td>Simple and easy to use<\/td>\n<td>May struggle with multicollinearity<\/td>\n<\/tr>\n<tr>\n<td>Ridge Regression<\/td>\n<td>Handles multicollinearity<\/td>\n<td>Adds complexity to the model<\/td>\n<\/tr>\n<tr>\n<td>Lasso Regression<\/td>\n<td>Handles multicollinearity and performs feature selection<\/td>\n<td>Adds complexity to the model<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Whether you&#8217;re a beginner just starting out with sklearn&#8217;s linear regression or an experienced data scientist looking to level up your skills, we hope this guide has given you a deeper understanding of sklearn linear regression and its capabilities. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you finding it challenging to master linear regression in Python? You&#8217;re not alone. Many data scientists and machine learning enthusiasts find this task daunting. But, think of sklearn&#8217;s linear regression as a powerful tool &#8211; capable of drawing the best fitting line through your data with ease. Whether you&#8217;re working on a simple linear [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11050,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[121,123],"tags":[],"class_list":["post-4672","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming-coding","category-python","cat-121-id","cat-123-id","has_thumb"],"_links":{"self":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/4672","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/comments?post=4672"}],"version-history":[{"count":9,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/4672\/revisions"}],"predecessor-version":[{"id":16875,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/4672\/revisions\/16875"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/11050"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=4672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=4672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=4672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}