<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Odumuyiwa Teslim</title>
    <description>The latest articles on Forem by Odumuyiwa Teslim (@tesprogram).</description>
    <link>https://forem.com/tesprogram</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F898516%2Feaad6672-48e2-41b3-b6bb-89385895b1f0.png</url>
      <title>Forem: Odumuyiwa Teslim</title>
      <link>https://forem.com/tesprogram</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tesprogram"/>
    <language>en</language>
    <item>
      <title>11 Essential Considerations When Implementing an Ecommerce Cart</title>
      <dc:creator>Odumuyiwa Teslim</dc:creator>
      <pubDate>Tue, 07 Mar 2023 13:10:49 +0000</pubDate>
      <link>https://forem.com/medusajs/11-essential-considerations-when-implementing-an-ecommerce-cart-2n43</link>
      <guid>https://forem.com/medusajs/11-essential-considerations-when-implementing-an-ecommerce-cart-2n43</guid>
      <description>&lt;p&gt;Ecommerce cart functionality is essential for the success of an online store, as it is a way for customers to interact with the store and make their purchases. A properly designed cart can make the shopping experience simple, intuitive, and enjoyable, while a poorly designed cart can frustrate customers and lead to abandoned purchases.&lt;/p&gt;

&lt;p&gt;The ecommerce cart plays several important roles in the online shopping process such as allowing customers to manage the products in their carts, display all total information, and more.&lt;/p&gt;

&lt;p&gt;This article outlines the crucial aspects to consider for a successful ecommerce cart that satisfies both user needs and technical requirements.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What is Medusa?&lt;/strong&gt; &lt;a href="https://medusajs.com/"&gt;Medusa&lt;/a&gt; is an open source set of ecommerce building blocks that aims to provide a flexible developer experience. Developers and business have full freedom in how they shape their ecommerce application, including how they can implement a cart. Learn how to get started with Medusa in &lt;a href="https://docs.medusajs.com/usage/create-medusa-app"&gt;the documentation&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Cart User Experience Considerations
&lt;/h2&gt;

&lt;p&gt;Are you aware that the average shopping &lt;a href="https://baymard.com/lists/cart-abandonment-rate"&gt;cart abandonment rate is 69.82%&lt;/a&gt;? The journey doesn't end there despite a customer clicking “add to cart ” on your &lt;a href="https://medusajs.com/blog/what-i-learned-from-studying-500-b2b-ecommerce-sites/"&gt;product&lt;/a&gt; page. Several new challenges come into play once a customer places a product into their shopping cart.&lt;/p&gt;

&lt;p&gt;Remember that getting potential customers to add an item to their cart is just the starting point. It's an opportunity to convert that into a sale. One key factor in achieving this is the &lt;a href="https://medusajs.com/blog/9-best-ecommerce-ux-practices-with-examples/"&gt;user experience&lt;/a&gt; of your ecommerce platform.&lt;/p&gt;

&lt;h3&gt;
  
  
  Allow Users to Add, Remove and View Items in Their Cart
&lt;/h3&gt;

&lt;p&gt;Customers should feel in control, so provide them with the option to delete items from their cart easily. However, you can also include a confirmation pop-up to ensure the action was intentional.&lt;/p&gt;

&lt;p&gt;Make it simple for customers to edit items in their cart as well. For example, provide options to adjust the quantity with "+" or "-" buttons, a drop-down menu, or a box for manual entry. As demonstrated in the example below from the &lt;a href="https://medusajs.com/blog/nextjs-ecommerce-storefront-comes-packed-with-ready-integrations-to-paypal-meilisearch-stripe-and-more/"&gt;Medusa Next.js&lt;/a&gt; storefront:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sFFC0fdY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7f7ce7qo3poepk80269.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sFFC0fdY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7f7ce7qo3poepk80269.png" alt="Image description" width="880" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ensure that any modifications made to the cart are reflected in the product image and information. The goal is to keep the customer on the cart page and make the buying process seamless. Avoid redirecting customers back to the product page for any changes. The buying journey should be a progressive one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Be Upfront About Costs
&lt;/h3&gt;

&lt;p&gt;To avoid losing customers, make sure the prices on your cart pages are clear and easy to understand. Hidden fees or unexpected costs can make customers feel tricked and discourage them from completing their purchase. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://baymard.com/blog/ecommerce-checkout-usability-report-and-benchmark"&gt;According to a study by the Baymard Institute, 55% of customers cited&lt;/a&gt; extra costs as the main reason for leaving their cart. To prevent this, clearly display taxes and shipping costs on their own line, along with the subtotal and total cost of the cart. &lt;/p&gt;

&lt;p&gt;If these costs vary by location, consider adding a tax, shipping calculator, and conversion rate to your page, so customers can see the costs before they checkout. A perfect example is the Medusa storefront sample used below, which shows the subtotal, shipping, and tax fee with the total cost. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9NsRRvvL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sxtdfpb15ejp3oo5zjq4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9NsRRvvL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sxtdfpb15ejp3oo5zjq4.png" alt="Image description" width="364" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Don’t Force Buyers to Create Accounts
&lt;/h3&gt;

&lt;p&gt;Many customers abandon their shopping carts because creating an account on the website can take time and effort.&lt;a href="https://www.drip.com/blog/cart-abandonment-statistics"&gt; In fact, 34% of people who took a survey by the Baymard Institute&lt;/a&gt; cited this as a reason to abandon their shopping carts. To prevent this, offer a "guest checkout" option that allows customers to purchase without creating an account. This way, customers can easily complete a purchase, even if they only plan on buying something once and without any fuss.&lt;/p&gt;

&lt;h3&gt;
  
  
  Offer Different Ways to Pay
&lt;/h3&gt;

&lt;p&gt;Giving customers many options to pay will make it more likely for them to complete a purchase. If you don't offer a customer's preferred payment on your website, it may discourage them from finishing their purchase. Offering a limited number of payment options can limit customer choice and decrease the likelihood of a sale. You can start with the most popular payment methods, such as credit and debit cards, PayPal, and Google Pay, then you can expand from there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1ZXOKJfN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6my9x84i52jdslj0apqb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1ZXOKJfN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6my9x84i52jdslj0apqb.png" alt="Image description" width="674" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: Nike Checkout&lt;/p&gt;

&lt;h3&gt;
  
  
  Simplify the Checkout Process
&lt;/h3&gt;

&lt;p&gt;Consolidating everything on a single page can improve customer experience and increase sales by eliminating multiple clicks and guesswork for shipping costs or account creation. Customers can see all necessary information on a single page, including payment processing, shipping details, and order information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--68li7kxR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vy8jmm892phgyco02cau.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--68li7kxR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vy8jmm892phgyco02cau.png" alt="Image description" width="880" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Make Buying on Mobile Easy
&lt;/h3&gt;

&lt;p&gt;Many people shop online using their phones. You could lose sales if your checkout process is not easy to use on the phone. Make sure your checkout page is set up for mobile users so they can easily complete their purchases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Abandoned Cart Recovery
&lt;/h3&gt;

&lt;p&gt;There are several ways to recover abandoned carts, including sending reminder emails, offering incentives, and displaying abandoned items on the customer's next visit to the website. These methods can remind customers of the items left in their cart and encourage them to complete their purchases.&lt;/p&gt;

&lt;p&gt;Offering special discounts or promotions for completing the purchase can also be effective. Another strategy is to track customer behavior, such as which items are frequently abandoned, and address any issues that may be causing customers to abandon their carts. &lt;/p&gt;

&lt;p&gt;From a technical perspective, you could implement a cron job that checks for newly created carts, if a cart is older than a specific amount of time, it would send an email to remind the customer of their cart and encourage them to complete their purchase.&lt;/p&gt;

&lt;p&gt;Overall, abandoned cart recovery is an important aspect of ecommerce and can lead to significant increases in sales and revenue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cart Technical Considerations
&lt;/h2&gt;

&lt;p&gt;Important things to consider when you create and manage an online store include keeping customer data secure, data storage, website performance, and real-time updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;p&gt;Ensuring the security of customer information is paramount in an ecommerce site. When choosing a shopping cart solution, you must look for certifications and compliance measures to protect your customers from identity and information theft. &lt;/p&gt;

&lt;p&gt;Investing in a shopping cart solution with robust security credentials is crucial to maintaining the trust of your customers. Keeping your customer's information secure and following laws protecting their data is another important part of it. For instance, businesses operating in the EU must comply with the General Data Protection Regulation (GDPR). In the US, the Health Insurance Portability and Accountability Act (HIPAA) are mandatory regulation. &lt;/p&gt;

&lt;p&gt;These regulations mandate strict requirements for handling and protecting sensitive customer information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sessions, Cookies, and Local Storage
&lt;/h3&gt;

&lt;p&gt;Storing items in a cart between visits is crucial for an ecommerce website. One way to accomplish this is by using sessions, cookies, and local storage. Both are used to store information about the customer's cart on their browser. &lt;/p&gt;

&lt;p&gt;Sessions are saved on the website's computer and only last as long as the customer’s tab is opened on the browser. Another session is created if the customer opens another tab for the same site. Once the customer closes the tab, the session is destroyed. Cookies are saved on the customer's computer and can last even if the customer closes the tab or browser. Local storage is a type of web storage that allows web applications to store and access data on the client side (i.e., in the user's web browser) with no expiration.&lt;/p&gt;

&lt;p&gt;This lets customers easily pick up where they left off and complete their purchase. Utilizing one of these options ensures customers a smooth and convenient shopping experience.&lt;/p&gt;

&lt;p&gt;An example of using local storage is storing cart ID in local storage. The CartID is retrieved from the server stored in the browser's local storage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Generate a unique cart ID&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;cartId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;value&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Store the cart ID in local storage&lt;/span&gt;
&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cartId&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cartId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code retrieves the cart information by retrieving the cartID stored in the local storage and then sends the cartID to make a request to the server, which fetches the cart details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cartId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cartId&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cartId&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`/cart?cartId=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;cartId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;cart&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//display cart details&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This implementation above shows how cookies and local storage could be used together to manage a shopping cart. The cart ID is stored locally to allow the client to retrieve the cart information from the server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-Time Price Update
&lt;/h3&gt;

&lt;p&gt;Updating the shopping cart and total price in real-time as the user makes changes is possible using JavaScript event listeners. For example, when a user clicks on the "add to cart" button, the JavaScript code will update the cart object and re-render the cart UI to reflect the change. &lt;/p&gt;

&lt;p&gt;Similarly, when a user changes the quantity of an item or removes an item from the cart, the JavaScript code will update the cart object and recalculate the total price. You can do this by assigning event listeners to the "add to cart", "remove from cart", and "quantity change" buttons.&lt;/p&gt;

&lt;p&gt;Additionally, the total price displayed on the page should be updated to reflect the changes. This is just a basic example, you might need to follow extra steps to handle situations like trying to add an item that's unavailable yet or adding the same item more than once.&lt;/p&gt;

&lt;p&gt;The site's performance must be considered, as recalculating the total price on every change may negatively affect the performance. Here is an example of how you might implement real-time updating of the cart and total price using JavaScript:&lt;/p&gt;

&lt;p&gt;Note: This implementation focuses solely on client-side storage of the cart information. In a real-world scenario, communication with the server would be necessary to ensure the cart information is updated and accurate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// Assign event listeners to the add to cart, remove from cart, and quantity change buttons
document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"add-to-cart-button"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.addEventListener&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"click"&lt;/span&gt;, addToCart&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"remove-from-cart-button"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.addEventListener&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"click"&lt;/span&gt;, removeFromCart&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"quantity-change-button"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.addEventListener&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"change"&lt;/span&gt;, updateQuantity&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// Cart object to store the items &lt;span class="k"&gt;in &lt;/span&gt;the cart
&lt;span class="nb"&gt;let &lt;/span&gt;cart &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// Function to add an item to the cart
&lt;span class="k"&gt;function &lt;/span&gt;addToCart&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    // Get item details from the page
    &lt;span class="nb"&gt;let &lt;/span&gt;item &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;id&lt;/span&gt;: document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"item-id"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.value,
        name: document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"item-name"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.value,
        price: document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"item-price"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.value
    &lt;span class="o"&gt;}&lt;/span&gt;
        // Call the calculate total price &lt;span class="k"&gt;function
        &lt;/span&gt;calculateTotalPrice&lt;span class="o"&gt;()&lt;/span&gt;

    // Add the item to the cart object
    cart[item.id] &lt;span class="o"&gt;=&lt;/span&gt; item&lt;span class="p"&gt;;&lt;/span&gt;

    // Re-render the cart UI to reflect the change
    renderCart&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

// Function to remove an item from the cart
&lt;span class="k"&gt;function &lt;/span&gt;removeFromCart&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    // Get the &lt;span class="nb"&gt;id &lt;/span&gt;of the item to be removed
    &lt;span class="nb"&gt;let &lt;/span&gt;itemId &lt;span class="o"&gt;=&lt;/span&gt; document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"item-id-to-remove"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.value&lt;span class="p"&gt;;&lt;/span&gt;

    // Remove the item from the cart object
    delete cart[itemId]&lt;span class="p"&gt;;&lt;/span&gt;

    // Re-render the cart UI to reflect the change
    renderCart&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    // Call the calculate total price &lt;span class="k"&gt;function
        &lt;/span&gt;calculateTotalPrice&lt;span class="o"&gt;()&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

// Function to update the quantity of an item &lt;span class="k"&gt;in &lt;/span&gt;the cart
&lt;span class="k"&gt;function &lt;/span&gt;updateQuantity&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    // Get the &lt;span class="nb"&gt;id &lt;/span&gt;of the item and the new quantity
    &lt;span class="nb"&gt;let &lt;/span&gt;itemId &lt;span class="o"&gt;=&lt;/span&gt; document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"item-id-to-update"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.value&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;let &lt;/span&gt;newQuantity &lt;span class="o"&gt;=&lt;/span&gt; document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"new-quantity"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.value&lt;span class="p"&gt;;&lt;/span&gt;

    // Update the quantity &lt;span class="k"&gt;in &lt;/span&gt;the cart object
    cart[itemId].quantity &lt;span class="o"&gt;=&lt;/span&gt; newQuantity&lt;span class="p"&gt;;&lt;/span&gt;

    // Re-calculate the total price
    &lt;span class="nb"&gt;let &lt;/span&gt;totalPrice &lt;span class="o"&gt;=&lt;/span&gt; calculateTotalPrice&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    // Update the total price displayed on the page
    document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"total-price"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.innerHTML &lt;span class="o"&gt;=&lt;/span&gt; totalPrice&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

// Function to calculate the total price of the items &lt;span class="k"&gt;in &lt;/span&gt;the cart
&lt;span class="k"&gt;function &lt;/span&gt;calculateTotalPrice&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;let &lt;/span&gt;totalPrice &lt;span class="o"&gt;=&lt;/span&gt; 0&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;let &lt;/span&gt;itemId &lt;span class="k"&gt;in &lt;/span&gt;cart&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        totalPrice +&lt;span class="o"&gt;=&lt;/span&gt; cart[itemId].price &lt;span class="k"&gt;*&lt;/span&gt; cart[itemId].quantity&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;totalPrice&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

// Function to render the cart UI
&lt;span class="k"&gt;function &lt;/span&gt;renderCart&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    // Clear the existing cart UI
    document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"cart"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.innerHTML &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    // Iterate through the items &lt;span class="k"&gt;in &lt;/span&gt;the cart and render them
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;let &lt;/span&gt;itemId &lt;span class="k"&gt;in &lt;/span&gt;cart&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;let &lt;/span&gt;item &lt;span class="o"&gt;=&lt;/span&gt; cart[itemId]&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nb"&gt;let &lt;/span&gt;itemElement &lt;span class="o"&gt;=&lt;/span&gt; document.createElement&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"div"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        itemElement.innerHTML &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;&amp;lt;p&amp;gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.name&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt; - &lt;span class="nv"&gt;$$&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;item.price&lt;span class="o"&gt;}&lt;/span&gt; x &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.quantity&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&amp;lt;/p&amp;gt;&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        document.getElementById&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"cart"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.appendChild&lt;span class="o"&gt;(&lt;/span&gt;itemElement&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Handling Out-of-Stock Items and Inventory Updates
&lt;/h3&gt;

&lt;p&gt;When running an online store, it's essential to have a plan for handling things like items that are out of stock or inventory changes. A good way to handle items that are out of stock is to offer related or replacement items, for example, “Sorry, Nike Air Force 1 is out of stock, but we have the Nike Air Force 2 available.”&lt;/p&gt;

&lt;p&gt;Another option is to show a message saying when the item will be back in stock and offer an option for customers to sign up for a mail notification to notify them when the item is available.&lt;/p&gt;

&lt;p&gt;You can also let customers backorder items and ship them when they become available. Use inventory software to keep track of stock and update the website in real time. Also, let customers know when an item they're interested in is back in stock via email or a notification.&lt;/p&gt;

&lt;p&gt;Limit the number of items a customer can purchase to the available stock and clearly communicate the item's status to customers so they can make informed decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we cover essential functionalities of an ecommerce cart from the user and technical standpoint, including responsiveness on mobile devices, access to various payment methods, offering guest accounts to new customers, handling out-of-stock items, real-time price updates, and saving the cart information in cookies.&lt;/p&gt;

&lt;p&gt;Learn more about how to make a great online store with the Medusa quickstart guide &lt;a href="https://docs.medusajs.com/usage/create-medusa-app"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The documentation also provides two important guides related to carts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.medusajs.com/guides/carts-in-medusa"&gt;How to implement a cart functionality&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.medusajs.com/advanced/storefront/how-to-implement-checkout-flow"&gt;How to implement checkout flow&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For any questions or support, you can reach the Medusa team through &lt;a href="https://discord.gg/medusajs"&gt;Discord&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Predicting Environment Impact of Food Production caused by C02 Emission</title>
      <dc:creator>Odumuyiwa Teslim</dc:creator>
      <pubDate>Mon, 31 Oct 2022 22:56:08 +0000</pubDate>
      <link>https://forem.com/tesprogram/predicting-environment-impact-of-food-production-caused-by-c02-emission-51e3</link>
      <guid>https://forem.com/tesprogram/predicting-environment-impact-of-food-production-caused-by-c02-emission-51e3</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will be predicting the C02 emissions and their impact on food production with MindsDB. MindsDB is an open-source machine-learning tool that brings automated machine learning to your database. MindsDB offers predictive capabilities in your database. &lt;/p&gt;

&lt;p&gt;To complete this tutorial, you are required to have a working MindsDB connection, either locally or via &lt;a href="http://cloud.mindsdb.com/"&gt;cloud.mindsdb.com&lt;/a&gt;. You can use this &lt;a href="https://docs.mindsdb.com/connect/mindsdb_editor/"&gt;guide&lt;/a&gt; to connect to the MindsDB cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Data Setup&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Connecting the data as a file&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Follow the steps below to upload a file to MindsDB Cloud.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to your &lt;a href="https://cloud.mindsdb.com/login"&gt;MindsDB Cloud&lt;/a&gt; account to open the MindsDB Editor.&lt;/li&gt;
&lt;li&gt;Navigate to &lt;code&gt;Add data&lt;/code&gt; the section by clicking the &lt;code&gt;Add data&lt;/code&gt; button located in the top right corner.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w3LKYexD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crrhqczsc8ioijbayn8d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w3LKYexD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crrhqczsc8ioijbayn8d.png" alt="Add Data" width="720" height="65"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the File tab
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2C7QHVDl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbi0vfbblwjw5at3vacb.png" alt="File Upload" width="720" height="404"&gt;
&lt;/li&gt;
&lt;li&gt;Choose the &lt;code&gt;Import File&lt;/code&gt; option.&lt;/li&gt;
&lt;li&gt;Upload a file &lt;a href="https://docs.google.com/spreadsheets/d/1BxW9Pg_43ctPXaDLN33gLN7cgem4sPYclimjIVIElVo/edit?usp=sharing"&gt;Food_Production.csv&lt;/a&gt;, name a table used to store the file data (here it is &lt;code&gt;Food_Production&lt;/code&gt;), and click the &lt;code&gt;Save and Continue&lt;/code&gt; button.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N3pwOp3j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4pvwd4uj7km5ceibrwgh.png" alt="File Upload" width="880" height="404"&gt;
&lt;/li&gt;
&lt;li&gt;Once you are done uploading, you can query the data directly with the;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Food_Production&lt;/span&gt; &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rLdjSGi5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwioz3s3bry4ngwlklbf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rLdjSGi5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwioz3s3bry4ngwlklbf.png" alt="Table Query" width="880" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Dataset
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Context&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;As the world’s population has expanded and gotten richer, the demand for food, energy, and water has seen a rapid increase. Not only has demand for all three increased, but they are also strongly interlinked: food production requires water and energy; traditional energy production demands water resources; agriculture provides a potential energy source. This article focuses on the environmental impacts of food. Ensuring everyone in the world has access to a nutritious diet in a sustainable way is one of the greatest challenges we face.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Content&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This dataset contains most 43 most common foods grown across the globe and 23 columns as their respective land, water usage, and carbon footprints.&lt;/p&gt;

&lt;p&gt;Columns&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Land use change - Kg CO2 - equivalents per kg product&lt;/li&gt;
&lt;li&gt;Animal Feed - Kg CO2 - equivalents per kg product&lt;/li&gt;
&lt;li&gt;Farm - Kg CO2 - equivalents per kg product&lt;/li&gt;
&lt;li&gt;Processing - Kg CO2 - equivalents per kg product&lt;/li&gt;
&lt;li&gt;Transport - Kg CO2 - equivalents per kg product&lt;/li&gt;
&lt;li&gt;Packaging - Kg CO2 - equivalents per kg product&lt;/li&gt;
&lt;li&gt;Retail - Kg CO2 - equivalents per kg product&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These represent greenhouse gas emissions per kg of food product(Kg CO2 - equivalents per kg product) across different stages in the lifecycle of food production.&lt;/p&gt;

&lt;p&gt;Eutrophication – the pollution of water bodies and ecosystems with excess nutrients – is a major environmental problem. The runoff of nitrogen and other nutrients from agricultural production systems is a leading contributor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Acknowledgments and Credits
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://ourworldindata.org/"&gt;https://ourworldindata.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Credit: &lt;a href="https://www.kaggle.com/selfvivek"&gt;Vivek&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Original Source: *&lt;strong&gt;&lt;em&gt;&lt;a href="https://www.kaggle.com/datasets/selfvivek/environment-impact-of-food-production"&gt;Environment Impact of Food Production&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;*&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the Predictor
&lt;/h2&gt;

&lt;p&gt;To being, let’s create a predictor that uses the columns to predict CO2 emission. You can learn more about creating a predictor by checking &lt;a href="https://docs.mindsdb.com/sql/create/predictor/"&gt;here&lt;/a&gt;. You can predict a classification series model using the following syntax&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;PREDICTOR&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.[&lt;/span&gt;&lt;span class="n"&gt;predictor_name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;integration_name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sequential_column&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;partition_column&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;other_column&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;target_column&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
     &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;table_name&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;PREDICT&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;target_column&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CREATE PREDICTOR&lt;/code&gt;: Creates a predictor with the name &lt;code&gt;predictor_name&lt;/code&gt; in the &lt;code&gt;mindsdb&lt;/code&gt; table.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;FROM files&lt;/code&gt;: Points to the table containing the data.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PREDICT&lt;/code&gt;: Dictates the column to predict.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;PREDICTOR&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CO2_emission&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Food_Produuction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;PREDICT&lt;/span&gt; &lt;span class="n"&gt;Total_emissions&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On execution we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;Query&lt;/span&gt; &lt;span class="n"&gt;successfully&lt;/span&gt; &lt;span class="n"&gt;completed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Status of a Predictor&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A predictor may take a couple of minutes for the training to complete. You can monitor the status of the predictor by using this SQL command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;predictors&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'CO2_emission'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your output should be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="c1"&gt;------------+&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="c1"&gt;------------+&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;complete&lt;/span&gt;   &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="c1"&gt;------------+&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Making Predictions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that we have our Prediction Model, we can simply execute some simple SQL query statements to predict the target value based on the feature parameters:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Making a Single Prediction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You can make predictions by querying the predictor as if it were a table. The &lt;strong&gt;&lt;a href="https://docs.mindsdb.com/sql/api/select/"&gt;SELECT&lt;/a&gt;&lt;/strong&gt; statement lets you make predictions for the &lt;code&gt;CO2_emission&lt;/code&gt; on the chosen feature parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Total_emissions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Total_emissions_explain&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CO2_emission&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;Food_Product&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Rice'&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Land_use_charge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Animal_Feed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Farm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Processing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Transport&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Packaging&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Retail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E3Ex7dhg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ego95hkzfh5v6nku7um.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E3Ex7dhg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ego95hkzfh5v6nku7um.png" alt="Single Prediction" width="880" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Making a Bulk Prediction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now let’s make bulk predictions or multiple predictions to predict the &lt;code&gt;CO2_emission&lt;/code&gt; by joining our table with the model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CO2_emission&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Food_Production&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output should be:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1JUnynLu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3besamtdtn2uub8tal2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1JUnynLu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3besamtdtn2uub8tal2.png" alt="Batch Predictions" width="880" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s Next?
&lt;/h2&gt;

&lt;p&gt;Have fun while trying it out yourself!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Star the &lt;strong&gt;&lt;a href="https://github.com/mindsdb/mindsdb"&gt;MindsDB repository on GitHub&lt;/a&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Sign up for a &lt;strong&gt;&lt;a href="https://cloud.mindsdb.com/register?_ga=2.126448781.1875715573.1663498526-358045687.1658244666&amp;amp;_gl=1*1us5k78*_ga*MzU4MDQ1Njg3LjE2NTgyNDQ2NjY.*_ga_7LGFPGV6XV*MTY2MzYwNjcxNi4zNi4xLjE2NjM2MDY3MzUuMC4wLjA"&gt;free MindsDB account&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Engage with the MindsDB community on &lt;strong&gt;&lt;a href="https://mindsdb.com/joincommunity?_ga=2.126448781.1875715573.1663498526-358045687.1658244666&amp;amp;_gl=1*1us5k78*_ga*MzU4MDQ1Njg3LjE2NTgyNDQ2NjY.*_ga_7LGFPGV6XV*MTY2MzYwNjcxNi4zNi4xLjE2NjM2MDY3MzUuMC4wLjA"&gt;Slack&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="https://github.com/mindsdb/mindsdb/discussions"&gt;GitHub&lt;/a&gt;&lt;/strong&gt; to ask questions and share your ideas and thoughts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Give a like or a comment if this tutorial was helpful&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>mindsdb</category>
      <category>machinelearning</category>
      <category>aws</category>
    </item>
    <item>
      <title>Predicting &amp; Visualizing Gas Prices with MindsDB and Tableau</title>
      <dc:creator>Odumuyiwa Teslim</dc:creator>
      <pubDate>Mon, 31 Oct 2022 22:54:40 +0000</pubDate>
      <link>https://forem.com/tesprogram/predicting-visualizing-gas-prices-with-mindsdb-and-tableau-d1p</link>
      <guid>https://forem.com/tesprogram/predicting-visualizing-gas-prices-with-mindsdb-and-tableau-d1p</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;MindsDB is an open-source machine-learning tool that brings automated machine learning to your database. MindsDB offers predictive capabilities in your database. Tableau lets you visualize your data easily and intuitively. In this tutorial, we will be using MindsDB to predict the hourly electricity demand in the United States and visualize results in Tableau. To complete this tutorial, you are required to have a working MindsDB connection, either locally or via &lt;a href="http://cloud.mindsdb.com/"&gt;cloud.mindsdb.com&lt;/a&gt;. You can use this &lt;a href="https://docs.mindsdb.com/connect/mindsdb_editor/"&gt;guide&lt;/a&gt; to connect to the MindsDB cloud.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Data Setup&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Connecting the data as a file&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Follow the steps below to upload a file to MindsDB Cloud.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to your &lt;a href="https://cloud.mindsdb.com/login"&gt;MindsDB Cloud&lt;/a&gt; account to open the MindsDB Editor.&lt;/li&gt;
&lt;li&gt;Navigate to &lt;code&gt;Add data&lt;/code&gt; the section by clicking the &lt;code&gt;Add data&lt;/code&gt; button located in the top right corner.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bVl7uwES--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3uaq9zg1x01sp6sckzv8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bVl7uwES--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3uaq9zg1x01sp6sckzv8.png" alt="File upload" width="720" height="65"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the Files tab.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6SxfsPHf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zb7d2v7mqc7g6u4z8ku2.png" alt="Upload options" width="880" height="495"&gt;
&lt;/li&gt;
&lt;li&gt;Choose the &lt;code&gt;Import File&lt;/code&gt; option.&lt;/li&gt;
&lt;li&gt;Upload a file (&lt;code&gt;2004-2021.tsv&lt;/code&gt;), name a table used to store the file data (here it is &lt;code&gt;gas_prices&lt;/code&gt; ), and click the &lt;code&gt;Save and Continue&lt;/code&gt; button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ufMauU0c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/knnde58k65eqvegd5bn5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ufMauU0c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/knnde58k65eqvegd5bn5.png" alt="Image description" width="880" height="495"&gt;&lt;/a&gt;&lt;br&gt;
Once you are done uploading, you can query the data directly with the;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gas_prices&lt;/span&gt; &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output would be:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UsyceG7h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2akfgtvq7n6i7q4a83g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UsyceG7h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2akfgtvq7n6i7q4a83g.png" alt="Image description" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Understanding the Dataset
&lt;/h2&gt;

&lt;p&gt;The National Agency of Petroleum, Natural Gas, and Biofuels (&lt;em&gt;ANP&lt;/em&gt; in Portuguese) releases weekly reports of gas, diesel, and other fuel prices used in transportation across the country. These datasets bring the mean value per liter, the number of gas stations analyzed and other information grouped by regions and states across the country.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The original dataset was written in Spanish and translated by me into English.&lt;/p&gt;
&lt;h3&gt;
  
  
  Context
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;INITIAL DATE&lt;/li&gt;
&lt;li&gt;FINAL DATE&lt;/li&gt;
&lt;li&gt;REGION&lt;/li&gt;
&lt;li&gt;STATE&lt;/li&gt;
&lt;li&gt;PRODUCT&lt;/li&gt;
&lt;li&gt;Visted_Gas_Station&lt;/li&gt;
&lt;li&gt;Measure_Unit&lt;/li&gt;
&lt;li&gt;Resell_mean_price&lt;/li&gt;
&lt;li&gt;Standard_deviation&lt;/li&gt;
&lt;li&gt;Min_Resell_Price&lt;/li&gt;
&lt;li&gt;Max_Resell_Price&lt;/li&gt;
&lt;li&gt;Mean_Resell_Margin&lt;/li&gt;
&lt;li&gt;Resell_Variant_COEF&lt;/li&gt;
&lt;li&gt;Mean_Price_Distribution&lt;/li&gt;
&lt;li&gt;Standard_Deviation_Distribution&lt;/li&gt;
&lt;li&gt;Min_Price_Distribution&lt;/li&gt;
&lt;li&gt;Max_Price_Distribution&lt;/li&gt;
&lt;li&gt;Max_Price_Distribution&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;What can be done with this dataset?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How different regions of Brazil saw their gas prices change?&lt;/li&gt;
&lt;li&gt;Within a region, which states increased more their prices?&lt;/li&gt;
&lt;li&gt;Which states are the cheapest (or most expensive) for different types of fuels?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this tutorial, we will be predicting the mean_price_distribution.&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Creating the Predictor&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Let’s create and train the machine learning model. For that, we will use the &lt;code&gt;CREATE PREDICTOR&lt;/code&gt; statement and specify the input columns used to train &lt;code&gt;FROM&lt;/code&gt;(features) and what we want to &lt;code&gt;PREDICT&lt;/code&gt;(labels).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This is a timestamp series model&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;PREDICTOR&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.[&lt;/span&gt;&lt;span class="n"&gt;predictor_name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;integration_name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sequential_column&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;partition_column&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;other_column&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;target_column&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
     &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;table_name&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;PREDICT&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;target_column&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sequential_column&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;partition_column&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;WINDOW&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;HORIZON&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CREATE PREDICTOR&lt;/code&gt;: Creates a predictor with the name &lt;code&gt;predictor_name&lt;/code&gt; in the &lt;code&gt;mindsdb&lt;/code&gt; table.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;FROM files&lt;/code&gt;: Points to the table containing the data.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PREDICT Close&lt;/code&gt;: Dictates the column to predict.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ORDER BY&lt;/code&gt;: Shows the column to arrange the data during training.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GROUP BY&lt;/code&gt;: It is optional. The column by which rows that make a partition are grouped. For example, if you want to forecast the inventory for all items in the store, you can partition the data by &lt;code&gt;product_id&lt;/code&gt;, so each distinct &lt;code&gt;product_id&lt;/code&gt;has its own time series.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WINDOW&lt;/code&gt;: Decides how many rows to "look back" into when creating a prediction.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;HORIZON&lt;/code&gt;: Specifies the number of future predictions. The default is 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s proceed to make predictions on our dataset:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;PREDICTOR&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gas_prices_brazil&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;gas_prices&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;PREDICT&lt;/span&gt; &lt;span class="n"&gt;Mean_Price_Distribution&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;FINAL_DATE&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;REGION&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;STATE&lt;/span&gt;
&lt;span class="c1"&gt;-- the target column to be predicted stores one row per quarter&lt;/span&gt;
&lt;span class="k"&gt;WINDOW&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;     
&lt;span class="n"&gt;HORIZON&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;    &lt;span class="c1"&gt;-- making forecasts for the next year (next 100 rows)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Status of a Predictor
&lt;/h2&gt;

&lt;p&gt;A predictor may take a couple of minutes for the training to complete. You can monitor the status of the predictor by using this SQL command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;predictors&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'hourly_electricity_demand'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we run it right immediately after creating a predictor, we get this output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+------------+
| status     |
+------------+
| generating |
+------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a while you will get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+------------+
| status     |
+------------+
| training   |
+------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And finally, this should be your output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+------------+
| status     |
+------------+
| complete   |
+------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Making Predictions
&lt;/h2&gt;

&lt;p&gt;Now that we have our Prediction Model, we can simply execute some simple SQL query statements to predict the target value based on the feature parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Final_Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Mean_Price_Distrubution&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gas_prices_brazil&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gas_prices&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output would be:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RbB-Lf2d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4328er4s5vixgdss6nf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RbB-Lf2d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4328er4s5vixgdss6nf.png" alt="Prediction Query Output" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting MindsDB to Tableau
&lt;/h2&gt;

&lt;p&gt;Tableau lets you visualize your data easily and intuitively. This tutorial will use Tableau to create visualizations of our predictions.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Connect
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First, create a new workbook in Tableau and open the &lt;em&gt;Connectors&lt;/em&gt;
tab in the &lt;em&gt;Connect to Data&lt;/em&gt; window.&lt;/li&gt;
&lt;li&gt;Click on MySQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---aFKeQGc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5s4l7bqx27nwdwle7mdp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---aFKeQGc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5s4l7bqx27nwdwle7mdp.png" alt="Connecting MindsDB to Tableau" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input "cloud.mindsdb.com" for Server, "3306" for Port, "mindsdb" for Database "your mindsdb cloud email" for Username, "your mindsdb cloud password" for Password, and Sign in.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--njyV2njO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uf6wjonk4nmo73frgfuc.png" alt="Input your MindsDB Cloud Details" width="880" height="495"&gt;
Now you are connected and your page should look like this:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YVA1T3xj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2u5brx4np52yi82d9sp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YVA1T3xj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2u5brx4np52yi82d9sp.png" alt="Tableau Interface" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Visualizing our Data
&lt;/h2&gt;

&lt;p&gt;Before you can visualize predictions in Tableau, you must first choose a data source. And because the predictions in this article are generated using a SQL statement, you will need to create a custom SQL query in Tableau to generate the data source. To do this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, select the &lt;code&gt;New Custom SQL&lt;/code&gt;on the left side of the window and use the query below to generate the mean price distributions for each date. You can preview the results or directly load the data into Tableau.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Final_Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Mean_Price_Distrubution&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gas_prices_brazil&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gas_prices&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y9ENrrWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kkbwtxc2p8l89c8flcmk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y9ENrrWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kkbwtxc2p8l89c8flcmk.png" alt="Image description" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create an extract of the data under the connection heading at the top right of the window. You do this to facilitate data conversion to the appropriate data type. The extraction should take some time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Move to the Sheet tab on the bottom left and right-click the &lt;code&gt;Mean_Price_Distribution&lt;/code&gt; and &lt;code&gt;Date&lt;/code&gt; to convert their data types to Number(Decimal) and Date, respectively. Additionally, when right-clicking on the &lt;code&gt;Mean_Price_Distribution&lt;/code&gt; and &lt;code&gt;Final_Date&lt;/code&gt;, choose the option to convert it to a continuous measure.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lTM-xea3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jd8mlc5drl1ejfk42dog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lTM-xea3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jd8mlc5drl1ejfk42dog.png" alt="Data Type" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5MGOeEkv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sz2cp03krs94l2a258nn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5MGOeEkv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sz2cp03krs94l2a258nn.png" alt="Data Type" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drag the &lt;code&gt;Mean_Price_Distribution&lt;/code&gt; measure to the row shelf and the &lt;code&gt;Final_Date&lt;/code&gt; dimension to the column shelf.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uSK37-eV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g8qavl1kvmekzis6i58c.png" alt="Data Type" width="880" height="495"&gt;
&lt;/li&gt;
&lt;li&gt;You can also switch the visualization also to the line, area and etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b0Qsbez9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d5q0ubuozcn44lyvuhwl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b0Qsbez9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d5q0ubuozcn44lyvuhwl.png" alt="Area Visualization" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mindsdb</category>
      <category>hacktoberfest</category>
      <category>machinelearning</category>
      <category>ai</category>
    </item>
    <item>
      <title>Predicting &amp; Visualizing Petroleum Production with MindsDB and Tableau</title>
      <dc:creator>Odumuyiwa Teslim</dc:creator>
      <pubDate>Mon, 31 Oct 2022 20:52:05 +0000</pubDate>
      <link>https://forem.com/tesprogram/predicting-visualizing-petroleum-production-with-mindsdb-and-tableau-373f</link>
      <guid>https://forem.com/tesprogram/predicting-visualizing-petroleum-production-with-mindsdb-and-tableau-373f</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;MindsDB is an open-source machine-learning tool that brings automated machine learning to your database. MindsDB offers predictive capabilities in your database. Tableau lets you visualize your data easily and intuitively. In this tutorial, we will be using MindsDB to predict the hourly electricity demand in the United States and visualize results in Tableau. To complete this tutorial, you are required to have a working MindsDB connection, either locally or via &lt;a href="http://cloud.mindsdb.com/"&gt;cloud.mindsdb.com&lt;/a&gt;. You can use this &lt;a href="https://docs.mindsdb.com/connect/mindsdb_editor/"&gt;guide&lt;/a&gt; to connect to the MindsDB cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Data Setup&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Connecting the data as a file&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Follow the steps below to upload a file to MindsDB Cloud.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to your &lt;a href="https://cloud.mindsdb.com/login"&gt;MindsDB Cloud&lt;/a&gt; account to open the MindsDB Editor.&lt;/li&gt;
&lt;li&gt;Navigate to &lt;code&gt;Add data&lt;/code&gt; the section by clicking the &lt;code&gt;Add data&lt;/code&gt; button located in the top right corner.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G79rmKcF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcm8ab1ezgbn07855jo1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G79rmKcF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcm8ab1ezgbn07855jo1.png" alt="File Upload into MindsDB" width="720" height="65"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the Files tab.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vyT_BOhM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5khtbnxh35jtncdad2lm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vyT_BOhM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5khtbnxh35jtncdad2lm.png" alt="Choose the Files tab" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the &lt;code&gt;Import File&lt;/code&gt; option.&lt;/li&gt;
&lt;li&gt;Upload a file (&lt;code&gt;[national_nameplate_capacity.csv](https://www.kaggle.com/datasets/maurosrgiofigueira/fuel-output-capacity-brazil), name a table used to store the file data (here it is&lt;/code&gt;petroleum_production&lt;code&gt; ), and click the &lt;/code&gt;Save and Continue` button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MV-mZnVc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uj9ruzwlfcdd2ly79rsv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MV-mZnVc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uj9ruzwlfcdd2ly79rsv.png" alt="File upload" width="880" height="495"&gt;&lt;/a&gt;&lt;br&gt;
Once you are done uploading, you can query the data directly with;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;sql&lt;br&gt;
SELECT * FROM files.petroleum_production LIMIT 10;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The output would be:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ohqQNHfH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwujhwb4urx5uu486kdi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ohqQNHfH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwujhwb4urx5uu486kdi.png" alt="Table Query Output" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Dataset
&lt;/h2&gt;

&lt;p&gt;This dataset presents Brazilian petroleum products ouput capacity evolution, from 2011 to 2020 in each Brazilian refinery. Data is displayed in barrels. From the Brazilian National Petroleum Agency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Context
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Refinery&lt;/strong&gt; -  They are 19 refinery in this dataset.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Year&lt;/strong&gt; - The year of this dataset ranges from 2011 to 2020.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nameplate Capacity&lt;/strong&gt; - &lt;strong&gt;Nameplate capacity&lt;/strong&gt;, also known as the &lt;strong&gt;rated capacity&lt;/strong&gt;, &lt;strong&gt;nominal capacity&lt;/strong&gt; , &lt;strong&gt;installed capacity&lt;/strong&gt;, or &lt;strong&gt;maximum effect&lt;/strong&gt;, is the intended full-load sustained output of a facility such as a power station, fuel plant and etc. (Source: &lt;a href="https://en.wikipedia.org/wiki/Nameplate_capacity"&gt;Wikipedia&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Creating the Predictor&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To being, let’s create a predictor that uses the date to predict the Petroleum Production for refineries. You can learn more about creating a predictor by checking &lt;a href="https://docs.mindsdb.com/sql/create/predictor/"&gt;here&lt;/a&gt;. You can predict a classification series model using the following syntax&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;sql&lt;br&gt;
CREATE PREDICTOR mindsdb.[predictor_name]&lt;br&gt;
FROM [integration_name]&lt;br&gt;
    (SELECT [sequential_column], [partition_column], [other_column], [target_column]&lt;br&gt;
     FROM [table_name])&lt;br&gt;
PREDICT [target_column]&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CREATE PREDICTOR&lt;/code&gt;: Creates a predictor with the name &lt;code&gt;predictor_name&lt;/code&gt; in the &lt;code&gt;mindsdb&lt;/code&gt; table.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;FROM files&lt;/code&gt;: Points to the table containing the data.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PREDICT&lt;/code&gt;: Dictates the column to predict.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`sql&lt;br&gt;
CREATE PREDICTOR mindsdb.petroleum_output&lt;br&gt;
FROM files (SELECT refinery, Year, Nameplate_Capacity FROM petroleum_production)&lt;br&gt;
PREDICT Nameplate_Capacity&lt;/p&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On execution we get:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
Query successfully completed&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Status of a Predictor&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A predictor may take a couple of minutes for the training to complete. You can monitor the status of the predictor by using this SQL command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;sql&lt;br&gt;
SELECT status&lt;br&gt;
FROM mindsdb.predictors&lt;br&gt;
WHERE name='petroleum_output';&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your output should be:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;sql&lt;br&gt;
+------------+&lt;br&gt;
| status     |&lt;br&gt;
+------------+&lt;br&gt;
| complete   |&lt;br&gt;
+------------+&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Making Predictions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that we have our Prediction Model, we can simply execute some simple SQL query statements to predict the target value based on the feature parameters:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;sql&lt;br&gt;
SELECT Year, Nameplate_Capacity&lt;br&gt;
FROM mindsdb.petroleum_output&lt;br&gt;
JOIN files.petroleum_production&lt;br&gt;
LIMIT 100;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i_wH0kxU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4wimbc7v24boe5wmkmv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i_wH0kxU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4wimbc7v24boe5wmkmv.png" alt="Predictions Query Output" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Connecting MindsDB to Tableau
&lt;/h1&gt;

&lt;p&gt;Tableau lets you visualize your data easily and intuitively. In this tutorial will use Tableau to create visualizations of our predictions.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How to Connect&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;First, create a new workbook in Tableau and open the &lt;em&gt;Connectors&lt;/em&gt; tab in the &lt;em&gt;Connect to Data&lt;/em&gt; window.&lt;/li&gt;
&lt;li&gt;Click on MySQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cPPVaSCz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ck1dj2z1x344bn2w9lfu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cPPVaSCz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ck1dj2z1x344bn2w9lfu.png" alt="Connecting MindsDB to Tableau" width="720" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;• Input “&lt;a href="http://cloud.mindsdb.com/"&gt;cloud.mindsdb.com&lt;/a&gt;” for Server, “3306” for Port, “mindsdb” for Database “your mindsdb cloud email” for Username, “your mindsdb cloud password” for Password, and Sign in.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TTmoUbDu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvmd9jznyzmzcby95elr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TTmoUbDu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvmd9jznyzmzcby95elr.png" alt="Inputting Details for connection" width="720" height="404"&gt;&lt;/a&gt;&lt;br&gt;
Now you are connected and your page should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---JXRCGl_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bqflnwd1j7euqjf2ddd2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---JXRCGl_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bqflnwd1j7euqjf2ddd2.png" alt="Done connecting" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Visualizing our Data&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before you can visualize predictions in Tableau, you must first choose a data source. And because the predictions in this article are generated using a SQL statement, you will need to create a custom SQL query in Tableau to generate the data source. To do this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, select the &lt;code&gt;New Custom SQL&lt;/code&gt;on the left side of the window and use the query below to generate the petroleum production for each year. You can preview the results or directly load the data into Tableau.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;sql&lt;br&gt;
SELECT Year, Nameplate_Capacity&lt;br&gt;
FROM mindsdb.petroleum_output&lt;br&gt;
JOIN files.petroleum_production&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xx2tGPI---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vzwcwbopq7ie5ibfcqed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xx2tGPI---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vzwcwbopq7ie5ibfcqed.png" alt="Custom SQL Query" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an extract of the data under the connection heading at the top right of the window. You do this to facilitate data conversion to the appropriate data type. The extraction should take some time.&lt;/li&gt;
&lt;li&gt;Move to the Sheet tab on the bottom left and right-click on the &lt;code&gt;Nameplate_Capacity&lt;/code&gt; and &lt;code&gt;Year&lt;/code&gt; to convert their data types to Number(whole) and Date, respectively. Additionally, when right-clicking on the &lt;code&gt;Nameplate_Capacity&lt;/code&gt; and &lt;code&gt;Date&lt;/code&gt;, choose the option to convert it to a continuous measure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7PQl1ldP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ljb48fvuvmwjiy3idvqv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7PQl1ldP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ljb48fvuvmwjiy3idvqv.png" alt="Changing Data Type" width="880" height="495"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fU87jhFf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlhk9a3puwdiyasc8pk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fU87jhFf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlhk9a3puwdiyasc8pk8.png" alt="Changing Data Type" width="880" height="495"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4Q3YpYgR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w62cuib6sfbvpxqoebjz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4Q3YpYgR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w62cuib6sfbvpxqoebjz.png" alt="Changing Data Type" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drag the &lt;code&gt;Nameplate_Capacity&lt;/code&gt; measure to the row shelf and the &lt;code&gt;Year&lt;/code&gt; dimension to the column shelf.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F1B30ttG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uh4jwv0507ksw2ddfskj.png" alt="Visualization in Tableau" width="880" height="495"&gt;
&lt;/li&gt;
&lt;li&gt;You can also switch the visualization also to line, area and etc.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---qIXa_87--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37o7ogkkijfp55zspkpl.png" alt="Final Visualization" width="880" height="495"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What’s Next?
&lt;/h2&gt;

&lt;p&gt;Have fun while trying it out yourself!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Star the &lt;strong&gt;&lt;a href="https://github.com/mindsdb/mindsdb"&gt;MindsDB repository on GitHub&lt;/a&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Sign up for a &lt;strong&gt;&lt;a href="https://cloud.mindsdb.com/register?_ga=2.126448781.1875715573.1663498526-358045687.1658244666&amp;amp;_gl=1*1us5k78*_ga*MzU4MDQ1Njg3LjE2NTgyNDQ2NjY.*_ga_7LGFPGV6XV*MTY2MzYwNjcxNi4zNi4xLjE2NjM2MDY3MzUuMC4wLjA"&gt;free MindsDB account&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Engage with the MindsDB community on &lt;strong&gt;&lt;a href="https://mindsdb.com/joincommunity?_ga=2.126448781.1875715573.1663498526-358045687.1658244666&amp;amp;_gl=1*1us5k78*_ga*MzU4MDQ1Njg3LjE2NTgyNDQ2NjY.*_ga_7LGFPGV6XV*MTY2MzYwNjcxNi4zNi4xLjE2NjM2MDY3MzUuMC4wLjA"&gt;Slack&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="https://github.com/mindsdb/mindsdb/discussions"&gt;GitHub&lt;/a&gt;&lt;/strong&gt; to ask questions and share your ideas and thoughts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Give a like or a comment if this tutorial was helpful&lt;/p&gt;

</description>
      <category>mindsdb</category>
      <category>hacktoberfest</category>
      <category>machinelearning</category>
      <category>ai</category>
    </item>
    <item>
      <title>Predict Diamond prices with SQL Alchemy and MindsDB</title>
      <dc:creator>Odumuyiwa Teslim</dc:creator>
      <pubDate>Sat, 29 Oct 2022 19:40:11 +0000</pubDate>
      <link>https://forem.com/tesprogram/predict-diamond-prices-with-sql-alchemy-and-mindsdb-b4e</link>
      <guid>https://forem.com/tesprogram/predict-diamond-prices-with-sql-alchemy-and-mindsdb-b4e</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;In this tutorial, we will learn how to create, train and query a machine-learning model using a Python library called SQLAlchemy. SQLAlchemy is the most popular open-source library for working with relational databases from Python. It is one of the ORM libraries that provides an interface for using object-oriented programming to interact with a database. MindsDB is an open-source machine learning tool that brings predictive capabilities to your database. For this tutorial, we will be making use of the Kaggle dataset &lt;code&gt;diamond.csv&lt;/code&gt; to predict the price of the diamonds.&lt;/p&gt;

&lt;h1&gt;
  
  
  Prerequisite
&lt;/h1&gt;

&lt;p&gt;The following are the requirements for this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;SQLAlchemy&lt;/li&gt;
&lt;li&gt;MindsDB install via pip&lt;/li&gt;
&lt;li&gt;pymysql&lt;/li&gt;
&lt;li&gt;Any IDE of your choice preferably VS code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Connecting our Database
&lt;/h1&gt;

&lt;p&gt;Firstly, we need to upload our dataset into the MindsDB Cloud Interface follow this guide to learn how to upload to the interface &lt;a href="https://docs.mindsdb.com/sql/create/file/" rel="noopener noreferrer"&gt;here&lt;/a&gt;, and then you can download the &lt;code&gt;diamonds.csv&lt;/code&gt; dataset on kaggle &lt;a href="https://www.kaggle.com/datasets/shivam2503/diamonds" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, navigate into a working directory , then create a &lt;strong&gt;&lt;code&gt;main.py&lt;/code&gt;&lt;/strong&gt; file. To create a database connection, simply follow &lt;strong&gt;&lt;a href="https://docs.mindsdb.com/connect/sql-alchemy/" rel="noopener noreferrer"&gt;this guide&lt;/a&gt;&lt;/strong&gt; on how to do that using Sqlachemy and pymysql.&lt;/p&gt;

&lt;p&gt;When you are done, you should have something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sqlalchemy&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_engine&lt;/span&gt;

&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;teslimodumuyiwa@gmail.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MindsDB Cloud Password&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cloud.mindsdb.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3306&lt;/span&gt;
&lt;span class="n"&gt;database&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;establish_connection&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nf"&gt;create_engine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mysql+pymysql://&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;@&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;establish_connection&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Connection to the database is established&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Couldn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t connect to the database:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also check that your connection is successful by running the python file from your terminal using &lt;code&gt;python main.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbv9pq63g0wasclbfnob1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbv9pq63g0wasclbfnob1.png" alt="SQL Alchemy Connection successful"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To run further checks on your connection, you might want to run queries on the database to see if it returns some data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sqlalchemy&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_engine&lt;/span&gt;

&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;teslimodumuyiwa@gmail.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Your MindsDB Cloud Password&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cloud.mindsdb.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3306&lt;/span&gt;
&lt;span class="n"&gt;database&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;establish_connection&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nf"&gt;create_engine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mysql+pymysql://&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;@&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;establish_connection&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;eng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;eng&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM files.diamonds LIMIT 5;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Couldn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t connect to the database:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output would be:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffcpcky2w9hcbkjj5dd3z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffcpcky2w9hcbkjj5dd3z.png" alt="Query Table ouput in Terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Training a Predictor With &lt;code&gt;CREATE PREDICTOR&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;With that done, we can now train our machine-learning predictor. For that, we are going to use the &lt;code&gt;CREATE PREDICTOR&lt;/code&gt; syntax where we would specify what query we will train &lt;code&gt;FROM&lt;/code&gt;  and what to &lt;code&gt;PREDICT&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;By implementing the following code to predict the price of our diamond:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sqlalchemy&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_engine&lt;/span&gt;

&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;teslimodumuyiwa@gmail.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Your MindsDB Cloud Password&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cloud.mindsdb.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3306&lt;/span&gt;
&lt;span class="n"&gt;database&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;establish_connection&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nf"&gt;create_engine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mysql+pymysql://&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;@&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;establish_connection&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;eng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;eng&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CREATE PREDICTOR mindsdb.diamond_price FROM files (SELECT * FROM diamonds) PREDICT price;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Couldn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t connect to the database:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Checking the Status of our Predictor
&lt;/h1&gt;

&lt;p&gt;We can check the status of the model with the syntax below. If the query returns Complete, then the model is ready to be used, or else wait if it returns Training.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;eng&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT status FROM mindsdb.predictors WHERE name=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;diamond_price&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the training is not complete, you should get this printed in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;training&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the training is complete, you should get this printed in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;complete&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Making Predictions
&lt;/h1&gt;

&lt;p&gt;Now that we have our Prediction Model, we can simply execute some simple SQL query statements to predict the target value based on the feature parameters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making a Single Prediction
&lt;/h2&gt;

&lt;p&gt;You can make predictions by querying the predictor as if it were a table. The &lt;strong&gt;&lt;code&gt;[SELECT](https://docs.mindsdb.com/sql/api/select/)&lt;/code&gt;&lt;/strong&gt; statement lets you make predictions for the &lt;code&gt;diamonds&lt;/code&gt; on the chosen feature parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;
&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;eng&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT price, price_explain FROM mindsdb.diamond_price WHERE carat = 0.23 AND depth = 56.9;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output should be:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwzgy0yo8ai8w65zekl3t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwzgy0yo8ai8w65zekl3t.png" alt="Single Prediction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Make Batch Predictions with &lt;code&gt;JOIN&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;Now let’s make bulk predictions or multiple predictions to predict the &lt;code&gt;price&lt;/code&gt; by joining our table with our model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;bulk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT t.price AS real_price, m.price_explain AS explained_price, t.carat,  t.cut, t.color, t.depth, t.table FROM files.diamonds AS t JOIN mindsdb.diamond_price AS m LIMIT 10;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;eng&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bulk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On execution, you should get this printed into your terminal&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftxby1ymgj6fu67c585ae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftxby1ymgj6fu67c585ae.png" alt="Bulk Prediction on MindsDB"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What’s Next?
&lt;/h1&gt;

&lt;p&gt;Have fun while trying it out yourself!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Star the &lt;strong&gt;&lt;a href="https://github.com/mindsdb/mindsdb" rel="noopener noreferrer"&gt;MindsDB repository on GitHub&lt;/a&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Sign up for a &lt;strong&gt;&lt;a href="https://cloud.mindsdb.com/register?_ga=2.126448781.1875715573.1663498526-358045687.1658244666&amp;amp;_gl=1*1us5k78*_ga*MzU4MDQ1Njg3LjE2NTgyNDQ2NjY.*_ga_7LGFPGV6XV*MTY2MzYwNjcxNi4zNi4xLjE2NjM2MDY3MzUuMC4wLjA" rel="noopener noreferrer"&gt;free MindsDB account&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Engage with the MindsDB community on &lt;strong&gt;&lt;a href="https://mindsdb.com/joincommunity?_ga=2.126448781.1875715573.1663498526-358045687.1658244666&amp;amp;_gl=1*1us5k78*_ga*MzU4MDQ1Njg3LjE2NTgyNDQ2NjY.*_ga_7LGFPGV6XV*MTY2MzYwNjcxNi4zNi4xLjE2NjM2MDY3MzUuMC4wLjA" rel="noopener noreferrer"&gt;Slack&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="https://github.com/mindsdb/mindsdb/discussions" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/strong&gt; to ask questions and share your ideas and thoughts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Give a like or a comment if this tutorial was helpful&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>mindsdb</category>
      <category>machinelearning</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
