Book Image

The Artificial Intelligence Infrastructure Workshop

By : Chinmay Arankalle, Gareth Dwyer, Bas Geerdink, Kunal Gera, Kevin Liao, Anand N.S.
Book Image

The Artificial Intelligence Infrastructure Workshop

By: Chinmay Arankalle, Gareth Dwyer, Bas Geerdink, Kunal Gera, Kevin Liao, Anand N.S.

Overview of this book

Social networking sites see an average of 350 million uploads daily - a quantity impossible for humans to scan and analyze. Only AI can do this job at the required speed, and to leverage an AI application at its full potential, you need an efficient and scalable data storage pipeline. The Artificial Intelligence Infrastructure Workshop will teach you how to build and manage one. The Artificial Intelligence Infrastructure Workshop begins taking you through some real-world applications of AI. You’ll explore the layers of a data lake and get to grips with security, scalability, and maintainability. With the help of hands-on exercises, you’ll learn how to define the requirements for AI applications in your organization. This AI book will show you how to select a database for your system and run common queries on databases such as MySQL, MongoDB, and Cassandra. You’ll also design your own AI trading system to get a feel of the pipeline-based architecture. As you learn to implement a deep Q-learning algorithm to play the CartPole game, you’ll gain hands-on experience with PyTorch. Finally, you’ll explore ways to run machine learning models in production as part of an AI application. By the end of the book, you’ll have learned how to build and deploy your own AI software at scale, using various tools, API frameworks, and serialization methods.
Table of Contents (14 chapters)
Preface
4
4. The Ethics of AI Data Storage

5. Data Stores: SQL and NoSQL Databases

Activity 5.01: Managing the Inventory of an E-Commerce Website Using a MySQL Query

Solution

  1. Open a Terminal and run the MySQL client using the following command, based on your OS:

    Windows:

    mysql

    Linux:

    sudo mysql

    macOS:

    mysql
  2. Create and select the PacktFashion database using the following commands:
    Create database PacktFashion;
    use PacktFashion;

    You should get the following output:

    Figure 5.71: Created and selected database for operation

    Next, we will create the tables as per the data model.

  3. Create the manufacturer table based on the data model, as shown in the following query:
    CREATE TABLE manufacturer (m_id INT,
    m_name TEXT,
    m_created_at TIMESTAMP,
    PRIMARY KEY (m_id)
    );
  4. Create the products table based on the data model, as shown in the following query:
    CREATE TABLE products (p_id INT,
    p_name TEXT,
    p_buy_price FLOAT,
    p_manufacturer_id INT,
    p_created_at TIMESTAMP,
    PRIMARY KEY (p_id),
    FOREIGN KEY (p_manufacturer_id)
      ...