{"id":2167,"date":"2024-10-12T16:38:50","date_gmt":"2024-10-12T16:38:50","guid":{"rendered":"https:\/\/www.w3computing.com\/articles\/?p=2167"},"modified":"2024-10-12T16:38:53","modified_gmt":"2024-10-12T16:38:53","slug":"building-automl-systems-with-autokeras","status":"publish","type":"post","link":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/","title":{"rendered":"Building AutoML Systems with AutoKeras"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In machine learning, the quest for automated solutions that streamline the model-building process has led to the rise of AutoML (Automated Machine Learning) systems. AutoML systems aim to automate the labor-intensive tasks of data preprocessing, feature engineering, model selection, and hyperparameter tuning. One of the most prominent libraries in the AutoML space is <strong>AutoKeras<\/strong>, which leverages the power of deep learning and integrates seamlessly with Keras and TensorFlow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This tutorial is designed for those who have an intermediate understanding of machine learning and deep learning concepts. We will dive into how to build an AutoML system using AutoKeras, covering core functionalities and offering practical guidance on various types of models, including image classification, text classification, and structured data processing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why AutoKeras?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before we get into the technical details, it\u2019s important to understand why AutoKeras is an attractive choice for automating machine learning tasks.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Ease of use<\/strong>: AutoKeras abstracts much of the complexity involved in deep learning model creation. For someone who has a basic understanding of how Keras and TensorFlow work, transitioning to AutoKeras is seamless.<\/li>\n\n\n\n<li><strong>Flexibility<\/strong>: AutoKeras is designed to automate the most tedious parts of machine learning while still allowing manual fine-tuning if needed.<\/li>\n\n\n\n<li><strong>Integration with TensorFlow<\/strong>: Since AutoKeras builds on top of Keras and TensorFlow, you can take advantage of TensorFlow&#8217;s features, like distribution strategies and support for custom layers, which gives you a lot of flexibility.<\/li>\n\n\n\n<li><strong>Open-ended design<\/strong>: AutoKeras allows for defining custom search spaces, which is critical for advanced users who want more control over their models.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let\u2019s jump into the details of building AutoML systems with AutoKeras.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Core Concepts of AutoKeras<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">AutoKeras works by following the basic steps of the machine learning pipeline but automates many of the details that would typically be time-consuming and labor-intensive. At the core of AutoKeras are the following concepts:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Model Search<\/strong>: AutoKeras uses neural architecture search (NAS) to find the best architecture for your problem. You can control the search space or let AutoKeras decide.<\/li>\n\n\n\n<li><strong>Hyperparameter Optimization<\/strong>: AutoKeras automatically tunes the hyperparameters of the model, such as learning rate, batch size, number of layers, and more.<\/li>\n\n\n\n<li><strong>Data Processing<\/strong>: AutoKeras can automatically handle data preprocessing steps like scaling, normalization, and even missing data imputation in some cases.<\/li>\n\n\n\n<li><strong>Task-Specific API<\/strong>: AutoKeras provides task-specific APIs, such as for image classification, text classification, and structured data, which make it easy to start with specific use cases.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1. Installing AutoKeras and Dependencies<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before we start building any models, let&#8217;s ensure that we have the correct libraries installed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">AutoKeras requires TensorFlow as a backend, so if you don\u2019t already have it installed, you\u2019ll need to set it up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To install AutoKeras along with TensorFlow, use the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">pip install autokeras tensorflow<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">This command will install both AutoKeras and TensorFlow (if not already installed). Once the installation is complete, you are ready to use AutoKeras for automating machine learning tasks.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. AutoKeras for Image Classification<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Image classification is one of the most common tasks in computer vision, and AutoKeras excels at automating this. Let\u2019s start by building an image classification system using AutoKeras.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Dataset: CIFAR-10<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, we\u2019ll use the CIFAR-10 dataset, which consists of 60,000 images in 10 different classes, with 6,000 images per class. The dataset is preloaded in Keras, making it easy to access.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Load and Preprocess the Data<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First, we need to load and preprocess the CIFAR-10 dataset. This can be done as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> tensorflow <span class=\"hljs-keyword\">as<\/span> tf\n<span class=\"hljs-keyword\">from<\/span> tensorflow.keras.datasets <span class=\"hljs-keyword\">import<\/span> cifar10\n\n<span class=\"hljs-comment\"># Load the CIFAR-10 dataset<\/span>\n(x_train, y_train), (x_test, y_test) = cifar10.load_data()\n\n<span class=\"hljs-comment\"># Normalize the data to the range &#91;0, 1]<\/span>\nx_train, x_test = x_train \/ <span class=\"hljs-number\">255.0<\/span>, x_test \/ <span class=\"hljs-number\">255.0<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">This snippet loads the data and normalizes the pixel values between 0 and 1, which is a common preprocessing step for image classification tasks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Define the AutoKeras ImageClassifier<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now that the data is ready, we can define an AutoKeras <code>ImageClassifier<\/code>. The <code>ImageClassifier<\/code> is a high-level API designed specifically for image classification tasks.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> autokeras <span class=\"hljs-keyword\">as<\/span> ak\n\n<span class=\"hljs-comment\"># Initialize the ImageClassifier<\/span>\nclf = ak.ImageClassifier(\n    overwrite=<span class=\"hljs-literal\">True<\/span>,  <span class=\"hljs-comment\"># Overwrite existing models<\/span>\n    max_trials=<span class=\"hljs-number\">3<\/span>  <span class=\"hljs-comment\"># Limit the number of trials to save time<\/span>\n)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Here, we initialize the classifier with the option to overwrite existing models if any and set the maximum number of trials (iterations of architecture search). The <code>max_trials<\/code> parameter controls how long the search will run. In a production setting, you might want to increase this number to explore more architectures.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Train the Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">With the classifier set up, we can now train the model on the dataset.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Train the classifier<\/span>\nclf.fit(x_train, y_train, epochs=<span class=\"hljs-number\">10<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The <code>fit<\/code> method handles the training process. AutoKeras will automatically search for the best model architecture and hyperparameters for your task. The number of epochs refers to the number of times the model will iterate through the entire dataset during training.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Evaluate the Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once the training is complete, we can evaluate the model on the test set.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Evaluate the classifier<\/span>\ntest_loss, test_acc = clf.evaluate(x_test, y_test)\nprint(<span class=\"hljs-string\">f\"Test accuracy: <span class=\"hljs-subst\">{test_acc}<\/span>\"<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">AutoKeras automatically handles the evaluation as well, and you\u2019ll get the accuracy and loss of the model on the test data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Exporting the Best Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, after training and evaluation, you can export the best model found by AutoKeras for further use or fine-tuning.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Export the best model<\/span>\nmodel = clf.export_model()\n\n<span class=\"hljs-comment\"># Save the model for future use<\/span>\nmodel.save(<span class=\"hljs-string\">\"best_image_classifier_model.h5\"<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The <code>export_model<\/code> method will retrieve the best model that was found during the search process, and you can save it for later use.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Key Takeaways<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Model Search and Optimization<\/strong>: AutoKeras uses a search algorithm to automatically find the best neural network architecture for your task.<\/li>\n\n\n\n<li><strong>Hyperparameter Tuning<\/strong>: AutoKeras tunes hyperparameters like learning rate, batch size, and model architecture parameters automatically.<\/li>\n\n\n\n<li><strong>Simple API<\/strong>: With just a few lines of code, we were able to load data, preprocess it, define an image classification model, and train it using AutoKeras.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. AutoKeras for Text Classification<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Text classification is another common task in machine learning, especially for applications like sentiment analysis, spam detection, and topic classification. Let\u2019s explore how AutoKeras can simplify the process of building a text classification model.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Dataset: IMDB Movie Reviews<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For this example, we\u2019ll use the IMDB movie reviews dataset, which is a standard dataset for binary sentiment classification (positive or negative sentiment).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Load and Preprocess the Data<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First, we load the IMDB dataset, which is available in Keras.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">from<\/span> tensorflow.keras.datasets <span class=\"hljs-keyword\">import<\/span> imdb\n<span class=\"hljs-keyword\">from<\/span> tensorflow.keras.preprocessing.sequence <span class=\"hljs-keyword\">import<\/span> pad_sequences\n\n<span class=\"hljs-comment\"># Load the IMDB dataset<\/span>\n(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=<span class=\"hljs-number\">20000<\/span>)\n\n<span class=\"hljs-comment\"># Pad sequences to ensure uniform input size<\/span>\nx_train = pad_sequences(x_train, maxlen=<span class=\"hljs-number\">200<\/span>)\nx_test = pad_sequences(x_test, maxlen=<span class=\"hljs-number\">200<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Here, we load the dataset and restrict the vocabulary size to the top 20,000 most common words. Then, we use <code>pad_sequences<\/code> to ensure that all input sequences are of uniform length, which is necessary for training a deep learning model.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Define the AutoKeras TextClassifier<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Similar to the image classification task, we can define a <code>TextClassifier<\/code> for the text classification task.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> autokeras <span class=\"hljs-keyword\">as<\/span> ak\n\n<span class=\"hljs-comment\"># Initialize the TextClassifier<\/span>\nclf = ak.TextClassifier(\n    overwrite=<span class=\"hljs-literal\">True<\/span>,\n    max_trials=<span class=\"hljs-number\">3<\/span>  <span class=\"hljs-comment\"># Perform 3 trials of architecture search<\/span>\n)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The <code>TextClassifier<\/code> is a high-level API designed specifically for text classification tasks. We set <code>overwrite=True<\/code> to ensure that the search will start from scratch, and <code>max_trials=3<\/code> to limit the search space for demonstration purposes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Train the Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we train the model using the <code>fit<\/code> method.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Train the classifier<\/span>\nclf.fit(x_train, y_train, epochs=<span class=\"hljs-number\">5<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">AutoKeras will search for the best model architecture and hyperparameters during training. We set the number of epochs to 5 for demonstration purposes, but you can increase this for better performance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Evaluate the Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After training, we evaluate the model on the test set to see how well it performs.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Evaluate the classifier<\/span>\ntest_loss, test_acc = clf.evaluate(x_test, y_test)\nprint(<span class=\"hljs-string\">f\"Test accuracy: <span class=\"hljs-subst\">{test_acc}<\/span>\"<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">AutoKeras handles the evaluation process, and you will see the model\u2019s accuracy on the test data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Export the Best Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, we can export and save the best model found during the search.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Export the best model<\/span>\nmodel = clf.export_model()\n\n<span class=\"hljs-comment\"># Save the model for future use<\/span>\nmodel.save(<span class=\"hljs-string\">\"best_text_classifier_model.h5\"<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The exported model can be fine-tuned, deployed, or used for inference in future tasks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Key Takeaways<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Automated Text Preprocessing<\/strong>: AutoKeras handles much of the text preprocessing and model architecture selection automatically.<\/li>\n\n\n\n<li><strong>Quick Results<\/strong>: With minimal configuration, we can train a robust text classification model.<\/li>\n\n\n\n<li><strong>Hyperparameter Optimization<\/strong>: Similar to the image classification task, AutoKeras automatically tunes hyperparameters like learning rate and architecture parameters.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4. AutoKeras for Structured Data (Tabular Data)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In many real-world machine learning tasks, you\u2019ll encounter structured (or tabular) data. This type of data includes columns with features like numerical values, categorical values, and sometimes text data. AutoKeras provides an API specifically designed to handle structured data tasks such as regression and classification.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Dataset: Titanic Survival Prediction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For this example, we\u2019ll use the Titanic dataset, a common dataset for binary classification tasks, where the goal is to predict whether a passenger survived or not based on their attributes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Load and Preprocess the Data<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s first load the Titanic dataset. You can download this dataset from various sources, but for the sake of simplicity, we\u2019ll use the version available through the <code>seaborn<\/code> library.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> seaborn <span class=\"hljs-keyword\">as<\/span> sns\n<span class=\"hljs-keyword\">import<\/span> pandas <span class=\"hljs-keyword\">as<\/span> pd\n<span class=\"hljs-keyword\">from<\/span> sklearn.model_selection <span class=\"hljs-keyword\">import<\/span> train_test_split\n\n<span class=\"hljs-comment\"># Load the Titanic dataset<\/span>\ntitanic_data = sns.load_dataset(<span class=\"hljs-string\">'titanic'<\/span>)\n\n<span class=\"hljs-comment\"># Drop rows with missing values<\/span>\ntitanic_data = titanic_data.dropna()\n\n<span class=\"hljs-comment\"># Encode categorical columns<\/span>\ntitanic_data = pd.get_dummies(titanic_data, drop_first=<span class=\"hljs-literal\">True<\/span>)\n\n<span class=\"hljs-comment\"># Split the data into features and labels<\/span>\nX = titanic_data.drop(<span class=\"hljs-string\">'survived'<\/span>, axis=<span class=\"hljs-number\">1<\/span>)\ny = titanic_data&#91;<span class=\"hljs-string\">'survived'<\/span>]\n\n<span class=\"hljs-comment\"># Split the data into training and testing sets<\/span>\nx_train, x_test, y_train, y_test = train_test_split(X, y, test_size=<span class=\"hljs-number\">0.2<\/span>, random_state=<span class=\"hljs-number\">42<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">In this step, we load the dataset using <code>seaborn<\/code>, clean the data by dropping rows with missing values, and encode categorical columns using one-hot encoding. We then split the dataset into training and testing sets.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Define the AutoKeras StructuredDataClassifier<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we define a <code>StructuredDataClassifier<\/code> to handle the tabular data.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> autokeras <span class=\"hljs-keyword\">as<\/span> ak\n\n<span class=\"hljs-comment\"># Initialize the StructuredDataClassifier<\/span>\nclf = ak.StructuredDataClassifier(\n    overwrite=<span class=\"hljs-literal\">True<\/span>,\n    max_trials=<span class=\"hljs-number\">3<\/span>\n)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The <code>StructuredDataClassifier<\/code> is a high-level API designed specifically for structured data classification tasks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Train the Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We can now train the model on the Titanic dataset.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Train the classifier<\/span>\nclf.fit(x_train, y_train, epochs=<span class=\"hljs-number\">10<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">AutoKeras will automatically search for the best model architecture for the structured data. The number of epochs is set to 10 for demonstration, but this can be adjusted based on your needs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Evaluate the Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once training is complete, we can evaluate the model on the test set.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Evaluate the classifier<\/span>\ntest_loss, test_acc = clf.evaluate(x_test, y_test)\nprint(<span class=\"hljs-string\">f\"Test accuracy: <span class=\"hljs-subst\">{test_acc}<\/span>\"<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Step 5: Export the Best Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, export the best model for future use.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-16\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Export the best model<\/span>\nmodel = clf.export_model()\n\n<span class=\"hljs-comment\"># Save the model for future use<\/span>\nmodel.save(<span class=\"hljs-string\">\"best_structured_data_classifier.h5\"<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-16\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Key Takeaways<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Automated Feature Engineering<\/strong>: AutoKeras handles much of the feature engineering for structured data, like normalization and handling categorical features.<\/li>\n\n\n\n<li><strong>Hyperparameter Optimization<\/strong>: As with the other tasks, AutoKeras automatically tunes the model\u2019s hyperparameters.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5. Customizing the Search Space<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">One of the most powerful features of AutoKeras is the ability to customize the search space for model architectures. While AutoKeras can automatically search for a good model architecture, advanced users may want to define the search space to explore custom architectures.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example: Custom Image Classifier Search Space<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s an example of how to define a custom search space for an image classification task:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-17\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> autokeras <span class=\"hljs-keyword\">as<\/span> ak\n<span class=\"hljs-keyword\">from<\/span> keras_tuner <span class=\"hljs-keyword\">import<\/span> HyperParameters\n\n<span class=\"hljs-comment\"># Define a custom search space<\/span>\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">custom_model<\/span><span class=\"hljs-params\">(hp: HyperParameters)<\/span>:<\/span>\n    model = ak.ImageClassifier(overwrite=<span class=\"hljs-literal\">True<\/span>, max_trials=<span class=\"hljs-number\">3<\/span>)\n\n    <span class=\"hljs-comment\"># Add a custom layer configuration<\/span>\n    hp_units = hp.Int(<span class=\"hljs-string\">'units'<\/span>, min_value=<span class=\"hljs-number\">32<\/span>, max_value=<span class=\"hljs-number\">512<\/span>, step=<span class=\"hljs-number\">32<\/span>)\n    model.add(tf.keras.layers.Dense(units=hp_units, activation=<span class=\"hljs-string\">'relu'<\/span>))\n\n    <span class=\"hljs-keyword\">return<\/span> model\n\n<span class=\"hljs-comment\"># Initialize and train the custom model<\/span>\nclf = custom_model(HyperParameters())\nclf.fit(x_train, y_train, epochs=<span class=\"hljs-number\">10<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-17\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">This example defines a custom search space by adding a Dense layer to the model with a number of units that are tuned within a specified range (32 to 512). You can add more layers and specify different hyperparameters to explore more complex architectures.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Key Takeaways<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Custom Search Spaces<\/strong>: AutoKeras allows you to define custom search spaces for advanced use cases.<\/li>\n\n\n\n<li><strong>Flexible Model Building<\/strong>: You can use the full flexibility of Keras and TensorFlow within AutoKeras to build and search for custom model architectures.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">6. Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">AutoKeras is a powerful tool for building AutoML systems, offering automation and flexibility for a variety of machine learning tasks. Whether you&#8217;re dealing with image classification, text classification, or structured data, AutoKeras simplifies the process by automating model selection, hyperparameter tuning, and data preprocessing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this tutorial, we explored how to build AutoML systems using AutoKeras for different types of data. We learned how to use pre-built task-specific APIs, export models, and even customize the search space for more control. By leveraging AutoKeras, you can accelerate the development process and focus on building high-performance machine learning models with minimal effort.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">AutoKeras is an excellent tool for machine learning practitioners who want to save time without sacrificing performance. Whether you&#8217;re building prototypes or deploying production models, AutoKeras can help streamline the machine learning pipeline.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In machine learning, the quest for automated solutions that streamline the model-building process has led to the rise of AutoML (Automated Machine Learning) systems. AutoML systems aim to automate the labor-intensive tasks of data preprocessing, feature engineering, model selection, and hyperparameter tuning. One of the most prominent libraries in the AutoML space is AutoKeras, which [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[18,4,6],"tags":[],"class_list":["post-2167","post","type-post","status-publish","format-standard","category-artificial-intelligence","category-programming-languages","category-python","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Building AutoML Systems with AutoKeras<\/title>\n<meta name=\"description\" content=\"In machine learning, the quest for automated solutions that streamline the model-building process has led to the rise of AutoML\" \/>\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.w3computing.com\/articles\/building-automl-systems-with-autokeras\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Building AutoML Systems with AutoKeras\" \/>\n<meta property=\"og:description\" content=\"In machine learning, the quest for automated solutions that streamline the model-building process has led to the rise of AutoML\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-12T16:38:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-12T16:38:53+00:00\" \/>\n<meta name=\"author\" content=\"w3compadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"w3compadmin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/building-automl-systems-with-autokeras\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/building-automl-systems-with-autokeras\\\/\"},\"author\":{\"name\":\"w3compadmin\",\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/#\\\/schema\\\/person\\\/a550b3e20d78bb4f79b7c6b7b53f0561\"},\"headline\":\"Building AutoML Systems with AutoKeras\",\"datePublished\":\"2024-10-12T16:38:50+00:00\",\"dateModified\":\"2024-10-12T16:38:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/building-automl-systems-with-autokeras\\\/\"},\"wordCount\":1790,\"articleSection\":[\"Artificial Intelligence\",\"Programming Languages\",\"Python\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/building-automl-systems-with-autokeras\\\/\",\"url\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/building-automl-systems-with-autokeras\\\/\",\"name\":\"Building AutoML Systems with AutoKeras\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/#website\"},\"datePublished\":\"2024-10-12T16:38:50+00:00\",\"dateModified\":\"2024-10-12T16:38:53+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/#\\\/schema\\\/person\\\/a550b3e20d78bb4f79b7c6b7b53f0561\"},\"description\":\"In machine learning, the quest for automated solutions that streamline the model-building process has led to the rise of AutoML\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/building-automl-systems-with-autokeras\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/building-automl-systems-with-autokeras\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/building-automl-systems-with-autokeras\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Articles Home\",\"item\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Artificial Intelligence\",\"item\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/artificial-intelligence\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Building AutoML Systems with AutoKeras\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/#website\",\"url\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/\",\"name\":\"Developer Articles Hub\",\"description\":\"\",\"alternateName\":\"Developer Articles\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/#\\\/schema\\\/person\\\/a550b3e20d78bb4f79b7c6b7b53f0561\",\"name\":\"w3compadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/wp-content\\\/litespeed\\\/avatar\\\/bd481d404e42caa2763662a3bfe825f8.jpg?ver=1780141266\",\"url\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/wp-content\\\/litespeed\\\/avatar\\\/bd481d404e42caa2763662a3bfe825f8.jpg?ver=1780141266\",\"contentUrl\":\"https:\\\/\\\/www.w3computing.com\\\/articles\\\/wp-content\\\/litespeed\\\/avatar\\\/bd481d404e42caa2763662a3bfe825f8.jpg?ver=1780141266\",\"caption\":\"w3compadmin\"},\"sameAs\":[\"http:\\\/\\\/w3computing.com\\\/articles\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Building AutoML Systems with AutoKeras","description":"In machine learning, the quest for automated solutions that streamline the model-building process has led to the rise of AutoML","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.w3computing.com\/articles\/building-automl-systems-with-autokeras\/","og_locale":"en_US","og_type":"article","og_title":"Building AutoML Systems with AutoKeras","og_description":"In machine learning, the quest for automated solutions that streamline the model-building process has led to the rise of AutoML","og_url":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/","article_published_time":"2024-10-12T16:38:50+00:00","article_modified_time":"2024-10-12T16:38:53+00:00","author":"w3compadmin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"w3compadmin","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/#article","isPartOf":{"@id":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/"},"author":{"name":"w3compadmin","@id":"https:\/\/www.w3computing.com\/articles\/#\/schema\/person\/a550b3e20d78bb4f79b7c6b7b53f0561"},"headline":"Building AutoML Systems with AutoKeras","datePublished":"2024-10-12T16:38:50+00:00","dateModified":"2024-10-12T16:38:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/"},"wordCount":1790,"articleSection":["Artificial Intelligence","Programming Languages","Python"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/","url":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/","name":"Building AutoML Systems with AutoKeras","isPartOf":{"@id":"https:\/\/www.w3computing.com\/articles\/#website"},"datePublished":"2024-10-12T16:38:50+00:00","dateModified":"2024-10-12T16:38:53+00:00","author":{"@id":"https:\/\/www.w3computing.com\/articles\/#\/schema\/person\/a550b3e20d78bb4f79b7c6b7b53f0561"},"description":"In machine learning, the quest for automated solutions that streamline the model-building process has led to the rise of AutoML","breadcrumb":{"@id":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.w3computing.com\/articles\/building-automl-systems-with-autokeras\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Articles Home","item":"https:\/\/www.w3computing.com\/articles\/"},{"@type":"ListItem","position":2,"name":"Artificial Intelligence","item":"https:\/\/www.w3computing.com\/articles\/artificial-intelligence\/"},{"@type":"ListItem","position":3,"name":"Building AutoML Systems with AutoKeras"}]},{"@type":"WebSite","@id":"https:\/\/www.w3computing.com\/articles\/#website","url":"https:\/\/www.w3computing.com\/articles\/","name":"Developer Articles Hub","description":"","alternateName":"Developer Articles","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.w3computing.com\/articles\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.w3computing.com\/articles\/#\/schema\/person\/a550b3e20d78bb4f79b7c6b7b53f0561","name":"w3compadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.w3computing.com\/articles\/wp-content\/litespeed\/avatar\/bd481d404e42caa2763662a3bfe825f8.jpg?ver=1780141266","url":"https:\/\/www.w3computing.com\/articles\/wp-content\/litespeed\/avatar\/bd481d404e42caa2763662a3bfe825f8.jpg?ver=1780141266","contentUrl":"https:\/\/www.w3computing.com\/articles\/wp-content\/litespeed\/avatar\/bd481d404e42caa2763662a3bfe825f8.jpg?ver=1780141266","caption":"w3compadmin"},"sameAs":["http:\/\/w3computing.com\/articles"]}]}},"featured_image_src":null,"featured_image_src_square":null,"author_info":{"display_name":"w3compadmin","author_link":"https:\/\/www.w3computing.com\/articles\/author\/w3compadmin\/"},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/posts\/2167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/comments?post=2167"}],"version-history":[{"count":1,"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/posts\/2167\/revisions"}],"predecessor-version":[{"id":2168,"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/posts\/2167\/revisions\/2168"}],"wp:attachment":[{"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/media?parent=2167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/categories?post=2167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.w3computing.com\/articles\/wp-json\/wp\/v2\/tags?post=2167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}