<?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: Chandre Van Der Westhuizen</title>
    <description>The latest articles on Forem by Chandre Van Der Westhuizen (@chandrevdw31).</description>
    <link>https://forem.com/chandrevdw31</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%2F796920%2Fb7e04f5a-0294-4f4d-8e7f-2e24fab0387d.jpg</url>
      <title>Forem: Chandre Van Der Westhuizen</title>
      <link>https://forem.com/chandrevdw31</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/chandrevdw31"/>
    <language>en</language>
    <item>
      <title>How to build your Developer Portfolio with MindsDB: The symbiotic relationship between developers and Opensource in 2024.</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Thu, 23 May 2024 15:07:17 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/how-to-build-your-developer-portfolio-with-mindsdb-the-symbiotic-relationship-between-developers-and-opensource-in-2024-4e1a</link>
      <guid>https://forem.com/chandrevdw31/how-to-build-your-developer-portfolio-with-mindsdb-the-symbiotic-relationship-between-developers-and-opensource-in-2024-4e1a</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpbqoz6kdu2ier0arz7hy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpbqoz6kdu2ier0arz7hy.png" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
What can you as a developer do to showcase your potential and expertise? One of the many challenges developers face is finding employment as most companies don’t recruit developers who do not have working experience. &lt;/p&gt;

&lt;p&gt;Employers need to see proof of work that developers are capable and efficient. However, where does that leave freshly graduated students who have the qualifications but no experience and those who have been in the workforce but struggle with finding employment? Well Opensource has changed the game and is leading developers into a new era where they can gain experience working with different projects and enhance their skill set.&lt;/p&gt;

&lt;p&gt;Open Source is a great way to hone in your developer skills and simultaneously build up a proof of work portfolio regardless of being employed or unemployed by contributing to projects. Developers over the world seek for projects that they can contribute to, especially GitHub users who look for ways to fill up those gray boxes with green on their GitHub profile 😉&lt;/p&gt;

&lt;p&gt;From beginners  to advanced coders that seek challenges, MindsDB offers developers a wide range of ways that they can contribute to opensource while building your Developer Portfolio. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is MindsDB?
&lt;/h2&gt;

&lt;p&gt;MindsDB is the platform for customizing AI from enterprise data, enabling smarter organizations. It allows developers to build AI/ML applications fast. MindsDB integrates with numerous data sources, including databases, vector stores, and applications, and popular AI/ML frameworks, including AutoML and LLMs. In summary, MindsDB brings data and AI together, enabling intuitive implementation and automation of AI systems.&lt;/p&gt;

&lt;p&gt;You can gain experience on working with the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automated Fine-Tuning&lt;/li&gt;
&lt;li&gt;AI Agents&lt;/li&gt;
&lt;li&gt;AI-Powered Data Retrieval&lt;/li&gt;
&lt;li&gt;Data Enrichment&lt;/li&gt;
&lt;li&gt;Predictive Analytics&lt;/li&gt;
&lt;li&gt;In-Database Machine Learning&lt;/li&gt;
&lt;li&gt;AI Workflow Automation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to build your developer portfolio
&lt;/h2&gt;

&lt;p&gt;In today’s time, it is essential for developers to have their own GitHub profile that they can use to contribute to an open-source project. As MindsDB is Open Source, you will have no issue with utilizing GitHub to hone your skills. MindsDB has its own GitHub repository where issues are listed for developers to solve. From no-code, low-code, and code technical contributions, developers can choose at what level they want to contribute according to their capabilities.&lt;/p&gt;

&lt;p&gt;We will explore no-code, low-code to code contributions to help build your portfolio.&lt;/p&gt;

&lt;p&gt;No-Code, Low-Code:&lt;br&gt;
This is for every type of developer on any level of skill, meaning you will be able to do this with little to nothing experience as it involves no-code to low-code skills, which includes SQL.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://docs.mindsdb.com/contribute/issues"&gt;Reporting bugs and fixing typo’s.&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;This kind of contribution is for beginners looking for a start in contributing to open source. You can report any bugs found in MindsDB’s platform on their github repository issues page as well as fix any typos  on their documentation. This showcases your eye for detail and skill to find bugs for an application, something that is very critical for a company looking to enhance their product.&lt;/p&gt;

&lt;h4&gt;
  
  
  Technical writing
&lt;/h4&gt;

&lt;p&gt;This involves writing a blog or creating a video tutorial on how to use MindsDB. &lt;br&gt;
Here are a few ways you can contribute with writing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.mindsdb.com/contribute/integrations-readme"&gt;Write a README file&lt;/a&gt; - for existing handlers- MindsDB handlers require a clear, comprehensive and user friendly guide on how to contribute to or use the handler&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.mindsdb.com/contribute/tutorials"&gt;Write a Blog tutorial&lt;/a&gt; - Write about how to use the MindsDB product with it’s different features.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.mindsdb.com/contribute/docs"&gt;Write MindsDB Documentation&lt;/a&gt; - Contribute to MindsDB’s documentation and enhance the quality.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Technical writing skills and content creation are a great way to display your skill in being able to convey information and guides that help others understand a product. This is important for companies to have affable documentation that makes it easy for users to understand and trust using their platforms.&lt;/p&gt;

&lt;h4&gt;
  
  
  QA/UX Testing
&lt;/h4&gt;

&lt;p&gt;With MindsDB, you can QA test their platform with their integrations and user interface and report on any issues found or provide feedback as to what is working. This involves running SQL syntax that performs tasks and tests whether the code as well as the platform with its handler are functional. This improves the quality of the product. Companies find this as an important skill set as it enhances user experience and adds value, as their product/release cannot go to market without it being signed off by QA.&lt;/p&gt;

&lt;h3&gt;
  
  
  High Code
&lt;/h3&gt;

&lt;p&gt;This involves using the developers coding skills. Your skillset can include Python to build data, AI/ML and application integrations.&lt;/p&gt;

&lt;h4&gt;
  
  
  Fix Bugs/Issues
&lt;/h4&gt;

&lt;p&gt;Developers are able to check for issues to fix on &lt;a href="https://github.com/mindsdb/mindsdb/issues"&gt;MindsDB’s Github Issues Page&lt;/a&gt;. The issues are marked with labels that indicate what you can work on, which you can find &lt;a href="https://docs.mindsdb.com/contribute/issue-labels"&gt;here&lt;/a&gt;. Fixing bugs showcases that you are a problem solver and capable of resolving issues. Companies find this capability very valuable as it has an impact on the quality of their product and user experience.&lt;/p&gt;

&lt;h4&gt;
  
  
  Building Integrations
&lt;/h4&gt;

&lt;p&gt;Developers can showcase their Python skills by building integrations with existing &lt;a href="https://docs.mindsdb.com/contribute/data-handlers"&gt;Data handlers&lt;/a&gt;, &lt;a href="https://docs.mindsdb.com/contribute/ml-handlers"&gt;AI/ML handlers&lt;/a&gt; and, &lt;a href="https://docs.mindsdb.com/contribute/app-handlers"&gt;Applications&lt;/a&gt;. You can also enhance existing handlers with building features for integrations that have not been implemented yet. This contribution demonstrates that developers are capable of assisting companies in Python-related tasks, especially in building integrations that will assist with improving the quality of their product by elevating systems to work together efficiently.&lt;/p&gt;

&lt;h4&gt;
  
  
  Build AI/ML apps
&lt;/h4&gt;

&lt;p&gt;This is where people can exhibit their full potential as a developer. MindsDB allows developers to build AI/ML applications fast and also gives apps access to a wide range of data sources, LLMs, and other applications which enhances the capabilities of their applications. With MindsDB’s &lt;a href="https://docs.mindsdb.com/sdks/python/overview"&gt;Python SDK&lt;/a&gt; and &lt;a href="https://docs.mindsdb.com/sdks/javascript/overview"&gt;JavaScript SDK&lt;/a&gt;, you are able to build applications to your heart’s content with MindsDB as the back-end. Companies seek those who are able to build applications as creating one for their own company can increase brand value, generate more sales and revenue, and benefit customer experience which leads to better customer retention. You as a developer might also want to build an application that is fit to profit from and create your own business around.&lt;/p&gt;

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

&lt;p&gt;Developers and Open Source are in symbiosis- just as contributors improve a project, they also are provided the opportunity to demonstrate their skills and creativity. As much as it is enjoyable to create cool trendy projects, developers would be wise to use it as an opportunity to design meaningful projects that can be applied to real-world use cases with impact. &lt;/p&gt;

&lt;p&gt;MindsDB is a great way for you to interact with different data sources, model management, LLMs, AI integrations, and Automation. All these types of contributions can serve as proof of work for your developer portfolio, showcasing that you are a prudent developer capable of applying your skills and gaining experience. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;For information on how to contribute to &lt;a href="https://github.com/mindsdb/mindsdb"&gt;MindsDB&lt;/a&gt;, check out this &lt;a href="https://docs.mindsdb.com/contribute/contribute"&gt;Contribution guide&lt;/a&gt;.&lt;br&gt;
If you have any questions or would like to share your thoughts, you can join MindsDB’s vibrant community of developers and AI enthusiasts on &lt;a href="https://mindsdb.com/joincommunity"&gt;Slack&lt;/a&gt;. Explore their &lt;a href="https://github.com/mindsdb/mindsdb"&gt;Github Repository&lt;/a&gt; and feel free to give it a star!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Twitter: &lt;a href="https://twitter.com/Chan_vdw"&gt;@Chan_vdw&lt;/a&gt;&lt;br&gt;
Github: &lt;a href="https://github.com/chandrevdw31"&gt;chandrevdw31&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>developers</category>
      <category>opensource</category>
      <category>mindsdb</category>
      <category>ai</category>
    </item>
    <item>
      <title>AI-Powered Selection of Asset Management Companies using MindsDB and LlamaIndex</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Mon, 18 Sep 2023 14:21:40 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/ai-powered-selection-of-asset-management-companies-using-mindsdb-and-llamaindex-15ch</link>
      <guid>https://forem.com/chandrevdw31/ai-powered-selection-of-asset-management-companies-using-mindsdb-and-llamaindex-15ch</guid>
      <description>&lt;p&gt;Investors make use of Asset Management companies to efficiently manage their assets on their behalf without having any concerns, therefore choosing the correct company is very important which means investors need to query what they want to know in order to make a decision. Asset Management companies want to make sure that they can appeal to investors by providing them with information through their websites. Finding an asset management company that suits your needs and convincing investors to choose your asset management company to assist can be daunting for both parties. AI can alleviate this for both the investor and the asset management company by making sure the investor's questions are answered and the asset management company can answer questions without human interaction.&lt;/p&gt;

&lt;p&gt;Asset Management companies rely on their website to provide information about their investment and financial services so that investors are willing to choose them, but how does an investor simplify the process of obtaining answers about an asset management company? This can be resolved with MindsDB's integration with LlamaIndex by creating a Q&amp;amp;A model.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mindsdb.com/"&gt;MindsDB&lt;/a&gt; is an AI Automation platform for building AI/ML powered features and applications. It works by connecting any data source with any AI/ML model or framework and automating how real-time data flows between them. MindsDB is integrated with LlamaIndex, which makes use of its data framework for connecting custom data sources to large language models. LlamaIndex data ingestion allows you to connect to data sources like PDF’s, webpages, etc., provides data indexing and a query interface that takes input prompts from your data and provides knowledge-augmented responses, thus making it easy to Q&amp;amp;A over documents and webpages.&lt;/p&gt;

&lt;p&gt;For this case, let's explore how to create a Q&amp;amp;A model for the Asset Management company Blackrock that can help investors obtain information seamlessly. This can be done using LlamaIndex, OpenAI as the LLM, and &lt;a href="https://www.blackrock.com/za/individual/about-us"&gt;Blackrock’s About-Us webpage.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.blackrock.com/corporate"&gt;Blackrock&lt;/a&gt; is an asset management company that provides services to investors for investment, advisory and risk management solutions and makes a great example of how creating a Q&amp;amp;A model with MindsDB’s integration with LlamaIndex can be beneficial.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to create a Q&amp;amp;A model using MindsDB and LlamaIndex.
&lt;/h3&gt;

&lt;p&gt;MindsDB has a great SQL Editor in it's Cloud GUI for you to use. If you would like to sign up for a demo Cloud account, you can do so &lt;a href="https://cloud.mindsdb.com/"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To create a model, you will have to create the ML engine using the &lt;code&gt;CREATE ML_ENGINE&lt;/code&gt; syntax in the SQL Editor.&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;ML_ENGINE&lt;/span&gt; &lt;span class="n"&gt;engine_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;llama_index&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can provide the name &lt;code&gt;llamaindex&lt;/code&gt; to the ML_ENGINE.&lt;/p&gt;

&lt;p&gt;On execution, you get:&lt;/p&gt;

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

&lt;p&gt;We will make use of a file that has been uploaded into the GUI. If you would like to know how to upload a file, you can check the documentation &lt;a href="https://docs.mindsdb.com/sql/create/file"&gt;here.&lt;/a&gt;. You can find a sample dataset &lt;a href="https://github.com/chandrevdw31/mindsdb-tutorials/blob/main/Datasets/questions.csv"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To upload the file, navigate to the 'Add Icon' on the MindsDB Gui and &lt;code&gt;Upload File.&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;You can ensure that the data has been uploaded by selecting the file.&lt;/p&gt;

&lt;p&gt;Run the following syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM files.about_blackrock LIMIT 10;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On execution, you get:&lt;/p&gt;

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

&lt;p&gt;Once you have created the engine and successfully uploaded your file, you can create the model with the &lt;code&gt;CREATE MODEL&lt;/code&gt; 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;MODEL&lt;/span&gt; &lt;span class="n"&gt;model_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;datasource&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="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="n"&gt;column_to_be_predicted&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt;
  &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'llamaindex'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;index_class&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'vector_store_index'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'reader_type'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;source_url_link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'source_url_link'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;input_column&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'column_name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;openai_api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'your_api_key'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To ensure that the model is created based on the LlamaIndex engine, the &lt;code&gt;USING&lt;/code&gt; clause is used to include the &lt;code&gt;engine&lt;/code&gt; which is the ml_engine LlamaIndex, &lt;code&gt;index_class&lt;/code&gt; is used to define the type of index class used, &lt;code&gt;reader&lt;/code&gt; to define the type of reader for the data scrapping, &lt;code&gt;source_url_link&lt;/code&gt; defines the URL link used to get the answers from, &lt;code&gt;input_column&lt;/code&gt; defines the column used to prompt the model, and &lt;code&gt;openai_api_key&lt;/code&gt; is defined with your OpenAI key to gain access to  OpenAI models.&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;MODEL&lt;/span&gt; &lt;span class="n"&gt;qa_blackrock&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;about_blackrock&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;Answers&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt;
  &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'llamaindex'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;index_class&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'GPTVectorStoreIndex'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'DFReader'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;source_url_link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'https://www.blackrock.com/za/individual/about-us'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;input_column&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Questions'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;openai_api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'your_api_key'&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 get:&lt;/p&gt;

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

&lt;p&gt;Where:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Expression&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;qa_blackrock&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The name provided to the model.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;engine&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The engine used, which is Llamaindex.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;qa_blackrock&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The name provided of the model.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;engine&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The engine name - here, LlamaIndex.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;index_class&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The vector store index used.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;reader&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The reader that reads the data/webpage.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;input_column&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;prompt provided as a question to the model.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;openai_api_key&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;API key of the LLM OpenAI.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;source_url_link&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The webpage link.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;input_column&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The column that stores prompt to the model.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;openai_api_key&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;OpenAI API key.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The status of the model can be verified that it has trained successfully into a complete status by using the &lt;code&gt;DESCRIBE&lt;/code&gt; 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;DESCRIBE&lt;/span&gt; &lt;span class="n"&gt;qa_blackrock&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On execution, you get:&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Querying the Q&amp;amp;A model
&lt;/h3&gt;

&lt;p&gt;The Q&amp;amp;A model has been successfully created and can now be prompted with questions with the &lt;code&gt;SELECT&lt;/code&gt; statement.&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;Questions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Answers&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;qa_blackrock&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;Questions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'What is the best long term investment with minimal risks for private investors'&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 get:&lt;/p&gt;

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

&lt;p&gt;The answer provided is:&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;The&lt;/span&gt; &lt;span class="n"&gt;best&lt;/span&gt; &lt;span class="n"&gt;long&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;term&lt;/span&gt; &lt;span class="n"&gt;investment&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;minimal&lt;/span&gt; &lt;span class="n"&gt;risks&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;private&lt;/span&gt; &lt;span class="n"&gt;investors&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;diversified&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;cost&lt;/span&gt; &lt;span class="k"&gt;index&lt;/span&gt; &lt;span class="n"&gt;funds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;These&lt;/span&gt; &lt;span class="n"&gt;funds&lt;/span&gt; &lt;span class="n"&gt;typically&lt;/span&gt; &lt;span class="n"&gt;track&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;broad&lt;/span&gt; &lt;span class="n"&gt;market&lt;/span&gt; &lt;span class="k"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;such&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;S&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;P&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;provide&lt;/span&gt; &lt;span class="n"&gt;exposure&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;wide&lt;/span&gt; &lt;span class="n"&gt;variety&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;publicly&lt;/span&gt; &lt;span class="n"&gt;traded&lt;/span&gt; &lt;span class="n"&gt;companies&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;minimal&lt;/span&gt; &lt;span class="n"&gt;risk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;Blackrock&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;one&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;largest&lt;/span&gt; &lt;span class="n"&gt;asset&lt;/span&gt; &lt;span class="n"&gt;management&lt;/span&gt; &lt;span class="n"&gt;companies&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;world&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;offers&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="k"&gt;index&lt;/span&gt; &lt;span class="n"&gt;funds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exchange&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;traded&lt;/span&gt; &lt;span class="n"&gt;funds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt; &lt;span class="n"&gt;investment&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;private&lt;/span&gt; &lt;span class="n"&gt;investors&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 query batch predictions using the &lt;code&gt;JOIN&lt;/code&gt; clause.&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;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Questions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Answers&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;qa_blackrock&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;b&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;about_blackrock&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;a&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 get:&lt;/p&gt;

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

&lt;p&gt;The Q&amp;amp;A model has successfully retrieved information from the webpage and answered the questions prompted&lt;/p&gt;

&lt;h3&gt;
  
  
  How can Investors and Asset Management companies incorporate a Q&amp;amp;A model?
&lt;/h3&gt;

&lt;p&gt;Not only can the investors create this Q&amp;amp;A model for themself for decision-making about multiple asset management companies, but also the asset management company can use it to make sure that possible clients are equipped to have their questions answered.&lt;/p&gt;

&lt;p&gt;Asset Management companies can embed this Q&amp;amp;A model into their webpage which allows a reader/investor to prompt the model questions about the given webpage, therefore sparing time of having to read through the whole webpage and allowing investors to obtain the information they are looking for.&lt;/p&gt;

&lt;h3&gt;
  
  
  AI Workflows with MindsDB
&lt;/h3&gt;

&lt;p&gt;Being able to have users come to your website and QA your webpage is great, but being notified about the questions your webpage is receiving is even better.&lt;/p&gt;

&lt;p&gt;An AI workflow can be created by sending the questions prompting the Q&amp;amp;A model as slack notifications in an organization's Slack channel using MindsDB's application integration with Slack.&lt;/p&gt;

&lt;p&gt;Connecting Slack to MindsDB can be done in quick easy steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connecting an existing Slack Application to MindsDB OR&lt;/li&gt;
&lt;li&gt;Create a new Slack application to connect to MindsDB&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Slack-SDK is used to implement this handler, which is a Python Library offering a package for each of Slack’s APIs. As we are sending notifications to Slack,the Slack app token for authentication will be used to set up a Slack application to receive notifications. You can follow Method 1 in this &lt;a href="https://docs.mindsdb.com/integrations/app-integrations/slack"&gt;guide&lt;/a&gt; to see how you can set up a Slack app and a Bot User OAuth Token.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connecting Slack to MindsDB
&lt;/h3&gt;

&lt;p&gt;Once you have created a Slack app or have an existing one, you can go ahead and connect the Slack application to MindsDB.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;CREATE DATABASE&lt;/code&gt; syntax would be used to establish a connection between Slack and MindsDB using the Bot User OAuth Token.&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="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;slack_app&lt;/span&gt;
&lt;span class="k"&gt;WITH&lt;/span&gt;
  &lt;span class="n"&gt;ENGINE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'slack'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;PARAMETERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;"token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;"xoxb-your_token"&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 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;successfull&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Setting up an AI Workflow.
&lt;/h3&gt;

&lt;p&gt;As this use case is for a Q&amp;amp;A  model being embedded into a website, the model's data source will be adjusted.&lt;/p&gt;

&lt;p&gt;The question that will prompt the model will first be saved into a database, and then the model will be trained and provided an answer on the webpage.&lt;/p&gt;

&lt;p&gt;Instead of the model, that needs to be embedded into the website, which syntax is this:&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;MODEL&lt;/span&gt; &lt;span class="n"&gt;qa_blackrock&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;about_blackrock&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;Answers&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt;
  &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'blackrock_qa'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;index_class&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'GPTVectorStoreIndex'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'DFReader'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;source_url_link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'https://www.blackrock.com/za/individual/about-us'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;input_column&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Questions'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;openai_api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'your_api_key'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax will rather look like this:&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;MODEL&lt;/span&gt; &lt;span class="n"&gt;qa_blackrock&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="k"&gt;database&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="k"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;table&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;Answers&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt;
  &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'blackrock_qa'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;index_class&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'GPTVectorStoreIndex'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'DFReader'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;source_url_link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'https://www.blackrock.com/za/individual/about-us'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;input_column&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Questions'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;openai_api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'your_api_key'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the sake of this example,we will continue to use files as the datasource.&lt;/p&gt;

&lt;p&gt;Here is how to send messages to a Slack channel:&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;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;slack_app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;channels&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;"llama_test"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;"Here are questions from potential investors"&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 get:&lt;/p&gt;

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

&lt;p&gt;In the Slack channel you will see the message notification:&lt;/p&gt;

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

&lt;p&gt;Now you can set up a job to receive notifications each time your webpage gets prompted a question. The &lt;code&gt;CREATE JOB&lt;/code&gt; syntax will be used.&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;JOB&lt;/span&gt; &lt;span class="n"&gt;investor_questions&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;

&lt;span class="n"&gt;RETRAIN&lt;/span&gt; &lt;span class="n"&gt;qa_blackrock&lt;/span&gt;
 &lt;span class="k"&gt;USING&lt;/span&gt;
&lt;span class="n"&gt;join_learn_process&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;slack_app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;channels&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;"llama_test"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;"Here are questions from potential investors"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;slack_app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;channels&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nv"&gt;"llama_test"&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;concat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Question: '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Questions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s1"&gt;'Answer: '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Answers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;text&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;qa_blackrock&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;b&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;about_blackrock&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
  &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;EVERY&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="n"&gt;minutes&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will receive notifications every 5 minutes if the Q&amp;amp;A model is prompted:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5l5Rmc7u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otxi4d18w43oz1ovwrig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5l5Rmc7u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otxi4d18w43oz1ovwrig.png" alt="Image description" width="644" height="397"&gt;&lt;/a&gt;&lt;br&gt;
You have successfully set up a Q&amp;amp;A model that can be used to be embedded into your webpage and also have an AI workflow that sends notifications to your slack channel each time your model is prompted.&lt;/p&gt;

&lt;p&gt;This creates an overview of the kind of information that investors are looking for. It can help you see what services you lack and can implement into your business model. You can take these questions and enhance your webpage’s information. Thus improving the quality of your webpage even further. With the power of Large Language Models, MindsDB makes it possible to serve your potential interested investors, improving the consumer experience and leveraging the power of AI workflows to improve the quality of your company’s presentation as a website.&lt;/p&gt;

&lt;p&gt;You check out MindsDB by signing up for a &lt;a href="https://cloud.mindsdb.com/"&gt;demo account&lt;/a&gt;. If you would like to learn more you can visit &lt;a href="https://docs.mindsdb.com/what-is-mindsdb"&gt;MindsDB's Documentation&lt;/a&gt;. If you want to contribute to MindsDB, visit their &lt;a href="https://github.com/mindsdb/mindsdb"&gt;Github repository&lt;/a&gt; and if you like it give it a star. MindsDB has a vibrant Slack Community and amazing team that provides technical support, if you would like to join you can sign up &lt;a href="https://mindsdb.com/joincommunity"&gt;here. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Twitter:&lt;a href="https://twitter.com/Chan_vdw"&gt;Chan_vdw&lt;/a&gt;&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Github: &lt;a href="https://github.com/chandrevdw31"&gt;chandrevdw31&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mindsdb</category>
      <category>llamaindex</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>How Developers should take advantage of MindsDB's Integration with OpenAI Chat GPT-3</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Wed, 15 Feb 2023 15:22:28 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/how-developers-should-take-advantage-of-mindsdbs-integration-with-openai-chat-gpt-3-179l</link>
      <guid>https://forem.com/chandrevdw31/how-developers-should-take-advantage-of-mindsdbs-integration-with-openai-chat-gpt-3-179l</guid>
      <description>&lt;p&gt;As a developer, you look for new ways to minimize the amount of work you have to do in order to get your desired results. Traditional ML development pipelines and methods can be helpful, but you are searching for faster ways to subsume NLP capabilities that require less manual development work. So how do you harness the full capabilities of NLP? By using MindsDB's integration with OpenAI Chat GPT-3 which allows you as a developer to unlock the power of the large pre-trained language models from OpenAI effectively.&lt;/p&gt;

&lt;p&gt;Developers face the challenge of creating models that can answer questions with or without context and completing general prompts, and with the capacity of the NLP models it can be done smoothly.MindsDB's integration with OpenAI Chat GPT-3 and databases allows you to use the power of SQL to effortlessly extract insights from text data.&lt;/p&gt;

&lt;p&gt;Here are a few ways you can leverage the NLP Capabilities with MindsDB:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You will now be able to create models that can help your clients in the e-commerce,social media,customer service industry by using sentiment analysis to detect the emotion behind their customers’ reviews or requests for a product or service easily.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Being able to create models that can answer questions can help alleviate the heavy workload the customer service industry experiences and assist e-commerce companies' websites to have a point of communication where their customers could ask questions and immediately receive answers. You can also create models for educational purposes that allow users to ask questions about learning material and receive an answer without having to engage with a teacher/lecturer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using text summarization cuts down the time spent trying to read paragraphs of information and provides the main points that are important and relevant to the person who needs to receive the information.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;MindsDB was ranked 2nd Product of the Day on Product Hunt for their product launch for the MindsDB- OpenAI Chat GPT-3 integration&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With the In-Database and NLP capabilities,MindsDB provides a great opportunity for developers to simplify their own workload in delivering services to their clients. You can check out the MindsDB integration with OpenAI Chat GPT-3's documentation about NLP &lt;a href="https://docs.mindsdb.com/nlp/text-summarization-inside-mysql-with-openai" rel="noopener noreferrer"&gt;here&lt;/a&gt; and check out their examples.&lt;/p&gt;

&lt;p&gt;If you would like to find out more about MindsDB, you can visit their &lt;a href="https://mindsdb.com/" rel="noopener noreferrer"&gt;website&lt;/a&gt;.Feel free to bookmark MindsDB's &lt;a href="https://github.com/mindsdb/mindsdb" rel="noopener noreferrer"&gt;Github repository&lt;/a&gt; and give them a star.Engage with the MindsDB community on &lt;a href="https://mindsdb.com/joincommunity" rel="noopener noreferrer"&gt;Slack&lt;/a&gt; or &lt;a href="https://github.com/mindsdb/mindsdb" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; to ask questions and share your ideas and thoughts.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Twitter&lt;/em&gt; : &lt;a href="https://twitter.com/Chan_vdw" rel="noopener noreferrer"&gt;Chandre Van Der Westhuizen&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Github page&lt;/em&gt; : &lt;a href="https://github.com/chandrevdw31" rel="noopener noreferrer"&gt;Chandrevdw31&lt;/a&gt;&lt;/p&gt;

</description>
      <category>motivation</category>
      <category>productivity</category>
      <category>vibecoding</category>
      <category>watercooler</category>
    </item>
    <item>
      <title>MindsDB Hacktoberfest2022: Win a Cash Prize</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Mon, 17 Oct 2022 19:24:13 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/mindsdb-hacktoberfest2022-win-a-cash-prize-4adl</link>
      <guid>https://forem.com/chandrevdw31/mindsdb-hacktoberfest2022-win-a-cash-prize-4adl</guid>
      <description>&lt;h3&gt;
  
  
  Looking for an Opensource Github Repository to contribute to?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://mindsdb.com/hacktoberfest"&gt;MindsDB Hacktoberfest&lt;/a&gt; provides opportunities for everyone to contribute and stand a chance to win a cash prize.&lt;/p&gt;

&lt;p&gt;For this year's MindsDB Hacktoberfest there are 3 categories to participate in, one is submitting an idea for MindsDB Integrations. This is a great and easy way for you to participate in Hacktoberfest!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to enter and win a cash prize:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Share a well-described idea of a new MindsDB integration on &lt;a href="https://github.com/mindsdb/mindsdb/issues?q=is%3Aissue+is%3Aopen+label%3Ahacktoberfest"&gt;MindsDB's Github Repository&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Invite people you know to upvote your idea.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The top 3 authors, whose ideas will get the highest number of upvotes, are the winners. If multiple ideas have the same number of votes, the first one posted wins.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can submit as many ideas as you like. However, we will not sum up upvotes from multiple issues from a single author. We’ll take just one that has the highest number of votes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The top 3 authors will receive a cash prize:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first place gets $500 cash prize, plus MindsDB t-shirt, plus audio gadget.&lt;/li&gt;
&lt;li&gt;The second place gets $300 cash prize, plus MindsDB t-shirt, plus audio gadget.&lt;/li&gt;
&lt;li&gt;The third place gets $200 cash prize, plus MindsDB t-shirt, plus audio gadget.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://dev.tourl"&gt;See Rules&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rewards will be paid as one-time &lt;a href="https://docs.github.com/en/sponsors/receiving-sponsorships-through-github-sponsors"&gt;GitHub sponsorship&lt;/a&gt;. Each winner can choose one of the gadgets (&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6Frk-K9i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uo5zdu3wkvfc2mw8hww3.png"&gt;JBL Earbuds or Rugged Outdoor Speaker&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;We will announce the winners on our Community Slack during the first week of November.&lt;/p&gt;

</description>
      <category>mindsdb</category>
      <category>hacktoberfest</category>
      <category>opensource</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Hacktoberfest 2022 with MindsDB</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Fri, 07 Oct 2022 15:42:47 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/hacktoberfest-2022-with-mindsdb-cci</link>
      <guid>https://forem.com/chandrevdw31/hacktoberfest-2022-with-mindsdb-cci</guid>
      <description>&lt;h2&gt;
  
  
  It’s time to Hack!
&lt;/h2&gt;

&lt;p&gt;Join MindsDB’s Hacktoberfestivities by making Open Source Contributions and get a chance of winning a &lt;a href="https://www.razer.com/hard-bundles/Razer-Blade-15-Bundle-V5-Essential/RZHB-220912-11"&gt;Razer Blade 15 Laptop&lt;/a&gt;, cool audio gadgets, T-shirts and a cash prize.&lt;/p&gt;

&lt;p&gt;There are several categories of open issues that are ideal for first-time developers, low-code, and no-code contributors for you to check out on &lt;a href="https://mindsdb.com/hacktoberfest?utm_medium=social&amp;amp;utm_source=facebook&amp;amp;utm_campaign=hacktoberfest2022&amp;amp;fbclid=IwAR2pEKOc7hDKVTt93uBHQ4NmLAvWRXa6nI26jolQKG8KhnKwafkEkBcrajo"&gt;MindsDBs page&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Categories:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Integration ideas&lt;/strong&gt;&lt;br&gt;
Share a well-described idea of a new MindsDB integration. The authors of top upvoted ideas will get a T-shirt, cool audio gadgets, and a cash prize:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1st place: $500&lt;/li&gt;
&lt;li&gt;2nd place: $300&lt;/li&gt;
&lt;li&gt;3rd place: $200&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Code,Low &amp;amp; No-code&lt;/strong&gt;&lt;br&gt;
Make as many contributions of your choice to win a high-end Razer Blade 15 Laptop or one of 10 cool audio gadgets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Contribute to Docs&lt;/li&gt;
&lt;li&gt;Share Social Media Posts&lt;/li&gt;
&lt;li&gt;Report and/or fix a Bug&lt;/li&gt;
&lt;li&gt;Make a QA/UX Test&lt;/li&gt;
&lt;li&gt;Develop an Architectural Diagram&lt;/li&gt;
&lt;li&gt;Write a Tutorial&lt;/li&gt;
&lt;li&gt;Submit a UX Design&lt;/li&gt;
&lt;li&gt;Build a Data-Source Integration&lt;/li&gt;
&lt;li&gt;Make a Video Tutorial&lt;/li&gt;
&lt;li&gt;Build ML Framework Integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Video Tutorials&lt;/strong&gt;&lt;br&gt;
Make as many contributions of your choice to win a high-end Razer Blade 15 Laptop or one of 10 cool audio gadgets! Make video tutorials of using MindsDB and invite everyone to watch them on YouTube. The authors of the most popular videos will get a T-shirt, cool audio gadgets, and a cash prize::&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1st place: $1000&lt;/li&gt;
&lt;li&gt;2nd place: $500&lt;/li&gt;
&lt;li&gt;3rd place: $300&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For every 10 points, you will receive one entry into the draw for the awesome &lt;a href="https://www.razer.com/hard-bundles/Razer-Blade-15-Bundle-V5-Essential/RZHB-220912-11"&gt;Razer Blade 15 Laptop&lt;/a&gt; powered by the top NVIDIA GeForce RTX 3080 Ti GPU, 14-core Intel i9 CPU and more. &lt;/p&gt;

&lt;p&gt;You can also win one of the 10 gadgets of your choice: &lt;br&gt;
&lt;strong&gt;JBL Earbuds&lt;/strong&gt; or &lt;strong&gt;Rugged Outdoor Speaker&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To participate, you need to have your GitHub PRs merged and complete the form with your details.&lt;/p&gt;

&lt;p&gt;Please complete the form below to participate in the prize draw. You should complete the form just once with all your contributions listed. You will be able to edit your responses after submission. &lt;a href="https://docs.google.com/forms/d/e/1FAIpQLSeyuQGpu-gmVAbXPXMsT5bfFQk28qGNHlsOjz9kkHmgyQEFOw/viewform"&gt;The form can be found here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Entries will close at midnight (PST) Monday, 31st of October with the winner announced on the first week of November.&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>mindsdb</category>
      <category>opensource</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Predicting Employee Productivity using Machine Learning with MindsDB</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Thu, 21 Jul 2022 09:31:00 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/predicting-employee-productivity-using-machine-learning-with-mindsdb-58e1</link>
      <guid>https://forem.com/chandrevdw31/predicting-employee-productivity-using-machine-learning-with-mindsdb-58e1</guid>
      <description>&lt;p&gt;&lt;em&gt;Community Author:&lt;/em&gt; &lt;a href="https://github.com/chandrevdw31" rel="noopener noreferrer"&gt;&lt;strong&gt;Chandre Van Der Westhuizen&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The garment industry is an essential exemplar of industrial globalization. It is of utmost importance for the decision makers in the garment industry to analyze,track and predict the productivity performance of employees as the companies rely on the production and delivery performance of their factory workers to satisfy the massive global demands for garment products. MindsDB's in-database machine learning capabilities provides the convenience of predicting productivity to assist employers with employee management.&lt;/p&gt;

&lt;p&gt;This tutorial will explore how employers can make predictions on the productivity of employees producing garments using a machine learning regression predictive model. You will get to learn how to connect your database directly to MindsDB, create and train models and make predictions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Access to MindsDB &lt;a href="https://docs.mindsdb.com/setup/cloud/" rel="noopener noreferrer"&gt;Cloud&lt;/a&gt; or local deployment via &lt;a href="https://docs.mindsdb.com/setup/self-hosted/docker/" rel="noopener noreferrer"&gt;docker&lt;/a&gt; or &lt;a href="https://docs.mindsdb.com/setup/self-hosted/pip/windows/" rel="noopener noreferrer"&gt;pip installation.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Dataset: You can find the dataset on &lt;a href="https://www.kaggle.com/datasets/ishadss/productivity-prediction-of-garment-employees" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Connecting your Database to MindsDB.
&lt;/h2&gt;

&lt;p&gt;The first step will be to establish a database connection via MindsDB's GUI which has a SQL Editor that makes it easy to execute queries. MindsDB enables connections to your favorite databases, data warehouses and data lakes via the &lt;a href="https://docs.mindsdb.com/sql/create/databases/" rel="noopener noreferrer"&gt;CREATE DATABASE&lt;/a&gt; syntax.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First, we need to connect MindsDB to the database where the Employee producing garments data is stored:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access MindsDB GUI on either cloud or the URL 127.0.0.1:47334/&lt;/li&gt;
&lt;li&gt;On the default page, select the button Add Data or alternatively select the plug icon on the left sidebar.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The 'Select your data source' page will populate for you to choose your database type. MindsDB has a list of databases that can be chosen. For this tutorial we will be selecting the postgres database button.&lt;br&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%2Fl6vudxowviosvc6e7qkk.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%2Fl6vudxowviosvc6e7qkk.png" alt="db"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once you have selected the database type,the page will automatically navigate to the SQL Editor where the syntax to create a database connection will automatically populate for you to enter the required parameters.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The required parameters are:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CREATE DATABASE display_name  --- display name for database. &lt;/li&gt;
&lt;li&gt;WITH ENGINE = "postgres",     --- name of the mindsdb handler &lt;/li&gt;
&lt;li&gt;PARAMETERS = {

&lt;ul&gt;
&lt;li&gt;"user": " ",              --- Your database user.&lt;/li&gt;
&lt;li&gt;"password": " ",          --- Your password.&lt;/li&gt;
&lt;li&gt;"host": " ",              --- host, it can be an ip or an url. &lt;/li&gt;
&lt;li&gt;"port": "5432",           --- common port is 5432.&lt;/li&gt;
&lt;li&gt;"database": " "           --- The name of your database *optional.
} &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&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%2Fat6n4gm5lz9hry3afh1j.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%2Fat6n4gm5lz9hry3afh1j.png" alt="db"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the &lt;code&gt;Run&lt;/code&gt; button or Shift+Enter to execute the syntax. Once the Database connection is created the console will display a message 'Query successfully completed'.&lt;br&gt;
​&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Please note that some database connections require running a Ngrok tunnel to establish a connection.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Run the ngrok command in a terminal:&lt;/em&gt;&lt;/p&gt;


&lt;pre class="highlight shell"&gt;&lt;code&gt;ngrok tcp &lt;span class="o"&gt;[&lt;/span&gt;db-port]
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;em&gt;for example,if your port number is 5433 you will see a similar output:&lt;/em&gt;&lt;/p&gt;


&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;Session Status                online
Account                       myaccount (Plan: Free)
Version                       2.3.40
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
&lt;/span&gt;&lt;span class="gp"&gt;Forwarding                    tcp://6.tcp.ngrok.io:14789 -&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;localhost:5433
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;em&gt;The forwarded address information will be required when connecting to MindsDB's GUI. Select and copy the 'Forwarding' information, in this case it is &lt;code&gt;6.tcp.ngrok.io:14789&lt;/code&gt;, where 6.tcp.ngrok.io will be used for the host parameter and 14789 as the port number.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once the database integration is successful we can query the table from the database to ensure the data pulls through on MindsDB.&lt;/p&gt;

&lt;p&gt;You can run queries directly on your database. The below is an example of the syntax used:&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;example_db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datasource&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;table_name&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;We will run the query to preview the data:&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_predictions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;garments&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://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%2Fffig70c3815k4imsgo8y.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%2Fffig70c3815k4imsgo8y.png" alt="select"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;MindsDB also has a functionality to &lt;a href="https://docs.mindsdb.com/sql/api/select_files/" rel="noopener noreferrer"&gt;Upload a file and SELECT data from the file&lt;/a&gt; to create a machine learning model.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Understanding the data
&lt;/h3&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="nb"&gt;date&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;quarter&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;department&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;team&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;targeted_productivity&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;smv&lt;/span&gt;   &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;wip&lt;/span&gt;    &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;over_time&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;incentive&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;idle_time&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;idle_men&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;no_of_style_change&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;no_of_workers&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;actual_productivity&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="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;   &lt;span class="mi"&gt;12&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;8&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;41&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="mi"&gt;968&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;3660&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;50&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;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                  &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;5&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;800570492&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="mi"&gt;6&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;8&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1170&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;1920&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;50&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;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                  &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&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;800381944&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="mi"&gt;7&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;8&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="mi"&gt;984&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;6720&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;38&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;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                  &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&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;800125&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="mi"&gt;3&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;75&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;08&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="mi"&gt;795&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;6900&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;45&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;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                  &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;57&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;5&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;753683478&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="mi"&gt;2&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;75&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;87&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="mi"&gt;733&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;6000&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;34&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;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                  &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&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;753097531&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;p&gt;Where:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Column&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Data Type&lt;/th&gt;
&lt;th&gt;Usage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;date&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Date in MM-DD-YYYY&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;quarter&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A portion of the month. A month was divided into four quarters&lt;/td&gt;
&lt;td&gt;&lt;code&gt;character varying&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;department&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Associated department with the instance&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;day&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Day of the Week&lt;/td&gt;
&lt;td&gt;&lt;code&gt;character varying&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;team&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Associated team number with the instance&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;targeted_productivity&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Targeted productivity set by the Authority for each team for each day.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;smv&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Standard Minute Value, it is the allocated time for a task&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;wip&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Work in progress. Includes the number of unfinished items for products&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;over_time&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Represents the amount of overtime by each team in minutes&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;incentive&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Represents the amount of financial incentive (in BDT) that enables or motivates a particular course of action.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;idle_time&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The amount of time when the production was interrupted due to several reasons&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;idle_men&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The number of workers who were idle due to production interruption&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;no_of_style_change&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Number of changes in the style of a particular product&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;no_of_workers&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Number of workers in each team&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;actual_productivity&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The actual % of productivity that was delivered by the workers. It ranges from 0-1&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Label&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;A &lt;strong&gt;label&lt;/strong&gt; is the thing we're predicting—the y variable in simple linear regression.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;A &lt;strong&gt;feature&lt;/strong&gt; is an input variable—the x variable in simple linear regression.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Creating a Regression Machine Learning Predictive model.
&lt;/h2&gt;

&lt;p&gt;To make predictions, we will create a machine learning model using the &lt;a href="https://docs.mindsdb.com/sql/create/predictor/" rel="noopener noreferrer"&gt;&lt;code&gt;CREATE PREDICTOR&lt;/code&gt;&lt;/a&gt; statement and make a Regression prediction.&lt;br&gt;
In the syntax we will specify which columns/ features to use for training and what column the model should learn to predict as our target/label. In this case we will select all the data to train with and use the column 'Target' as our target variable/label that we want to predict.&lt;/p&gt;

&lt;p&gt;In the SQL Editor, the below syntax will be executed:&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;garments_productivity&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb_predictions&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="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;garments&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;actual_productivity&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Select the &lt;code&gt;Run&lt;/code&gt; button or Shift+Enter to execute the syntax. If there are no issues with creating the query you will receive the message in the console &lt;strong&gt;'Query successfully completed'.&lt;/strong&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%2F9ngdvdgh36eio6mfr7pm.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%2F9ngdvdgh36eio6mfr7pm.png" alt="create"&gt;&lt;/a&gt;&lt;br&gt;
The model can take a while to train. The status of the model's training can be checked with the below 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;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;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;'garments_productivity'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As soon as the model is created the status should show training.Once the model is finished training,the status will show complete. Below you can see that the model has an accuracy of 84%.&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%2Fthfn5gp88iv33pzqcf94.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%2Fthfn5gp88iv33pzqcf94.png" alt="select"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The Predictor Status Must be 'complete' Before Making a Prediction&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;p&gt;When the status of the predictor shows complete, we can go ahead and make a prediction. Predictions are made using the &lt;a href="https://docs.mindsdb.com/sql/api/select/" rel="noopener noreferrer"&gt;&lt;code&gt;SELECT&lt;/code&gt;&lt;/a&gt; statement by querying the predictor as if it is a table. We will provide the features with parameters to get a result.&lt;/p&gt;

&lt;p&gt;The below syntax will be used to make a prediction:&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;actual_productivity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actual_productivity_explain&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;garments_productivity&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'1/1/2015'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;quarter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'Quarter1'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;department&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'sweing'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'Thursday'&lt;/span&gt; 
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;team&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;targeted_productivity&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;8&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;smv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;26&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;wip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1108&lt;/span&gt; 
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;over_time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;7080&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;incentive&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;98&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;idle_time&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;idle_men&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;no_of_style_change&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;no_of_workers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;59&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the above syntax and you will see the below results:&lt;br&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%2Fvfohyiu3055hylpqrf90.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%2Fvfohyiu3055hylpqrf90.png" alt="prediction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The actual productivity has a value from 0-1.The model predicted that with these parameters provided the result for the productivity of the employees will be 0.93 and by using &lt;code&gt;Target_explain&lt;/code&gt; we can see the confidence levels which shows that the confidence_lower_bound is 0.8556 and confidence_higher_bound is 1. This means that the garment company can expect to have the productivity of the employees to be between 0.8556 and 1.&lt;/p&gt;
&lt;h2&gt;
  
  
  Making Batch Predictions.
&lt;/h2&gt;

&lt;p&gt;The model can also make batch predictions using the &lt;a href="https://docs.mindsdb.com/sql/api/join/" rel="noopener noreferrer"&gt;&lt;code&gt;JOIN&lt;/code&gt;&lt;/a&gt; clause:&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;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;actual_productivity&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;productivity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;actual_productivity&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;predicted_productivity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;quarter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;department&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;team&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;targeted_productivity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;smv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wip&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;over_time&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;incentive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;idle_time&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;idle_men&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;no_of_style_change&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;no_of_workers&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb_predictions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;garments&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="k"&gt;JOIN&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;garments_productivity&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;b&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;Results:&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;productivity&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;predicted_productivity&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;date&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;quarter&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;department&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;team&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;targeted_productivity&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;smv&lt;/span&gt;   &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;wip&lt;/span&gt;    &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;over_time&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;incentive&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;idle_time&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;idle_men&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;no_of_style_change&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;no_of_workers&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="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;800570492&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;7820790218694679&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;12&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;8&lt;/span&gt;                   &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;41&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;968&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3660&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;50&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;0&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;                  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;          &lt;span class="o"&gt;|&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;800381944&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;8169200021797305&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;6&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;8&lt;/span&gt;                   &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1170&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1920&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;50&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;0&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;                  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="o"&gt;|&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;800125&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;7619499385051534&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;7&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;8&lt;/span&gt;                   &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;984&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;6720&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;38&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;0&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;                  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;          &lt;span class="o"&gt;|&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;753683478&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;762949004815915&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3&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;75&lt;/span&gt;                  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;08&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;795&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;6900&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;45&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;0&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;                  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;57&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;          &lt;span class="o"&gt;|&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;753097531&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;752386052621824&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2015&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Quarter1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sweing&lt;/span&gt;     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Thursday&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&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;75&lt;/span&gt;                  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;87&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;733&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;6000&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;34&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;0&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;                  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&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;p&gt;&lt;em&gt;Want to try it out for yourself? Sign up for a &lt;a href="https://cloud.mindsdb.com/signup?utm_medium=community&amp;amp;utm_source=ext.%20blogs&amp;amp;utm_campaign=blog-crop-detection" rel="noopener noreferrer"&gt;free MindsDB account&lt;/a&gt; and join our community!&lt;br&gt;
Engage with MindsDB community on &lt;a href="https://join.slack.com/t/mindsdbcommunity/shared_invite/zt-o8mrmx3l-5ai~5H66s6wlxFfBMVI6wQ" rel="noopener noreferrer"&gt;Slack&lt;/a&gt; or &lt;a href="https://github.com/mindsdb/mindsdb/discussions" rel="noopener noreferrer"&gt;Github&lt;/a&gt; to ask questions, share and express ideas and thoughts!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Make sure to check out the official website of &lt;a href="https://mindsdb.com/" rel="noopener noreferrer"&gt;MindsDB&lt;/a&gt;. For more check out other &lt;a href="https://docs.mindsdb.com/" rel="noopener noreferrer"&gt;tutorials and MindsDB documentation&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>sql</category>
      <category>ai</category>
      <category>mindsdb</category>
    </item>
    <item>
      <title>MindsDB: Predicting Supply Chain Demand with Machine Learning using SQL</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Mon, 27 Jun 2022 18:16:52 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/mindsdb-predicting-supply-chain-demand-with-machine-learning-using-sql-47m3</link>
      <guid>https://forem.com/chandrevdw31/mindsdb-predicting-supply-chain-demand-with-machine-learning-using-sql-47m3</guid>
      <description>&lt;p&gt;&lt;em&gt;Community Author:&lt;/em&gt; &lt;a href="https://github.com/chandrevdw31" rel="noopener noreferrer"&gt;&lt;strong&gt;Chandre Van Der Westhuizen&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Supply Chain industry requires forecasting to plan for demand. This is critical to ensure that requirements for demand are met so that the business can run smoothly and keep shortages to a minimum. &lt;a href="https://mindsdb.com/" rel="noopener noreferrer"&gt;MindsDB's&lt;/a&gt; machine learning models can help predict the demand to uphold a company's service delivery.&lt;/p&gt;

&lt;p&gt;This tutorial will be exploring a Brazilian logistics company's dataset that has been collected during 60 days and predict the number of total orders. We will create and train a Regression predictive model and make predictions.&lt;/p&gt;

&lt;p&gt;This tutorial will be exploring a Brazilian logistics company's dataset that has been collected during 60 days and predict the number of total orders. We will create and train a Regression predictive model and make predictions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Access to MindsDB &lt;a href="https://docs.mindsdb.com/setup/cloud/" rel="noopener noreferrer"&gt;Cloud&lt;/a&gt; or local deployment via &lt;a href="https://docs.mindsdb.com/setup/self-hosted/docker/" rel="noopener noreferrer"&gt;docker&lt;/a&gt; or &lt;a href="https://docs.mindsdb.com/setup/self-hosted/pip/windows/" rel="noopener noreferrer"&gt;pip installation.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Dataset: You can find the Supply chain and Demand dataset on the &lt;a href="https://archive-beta.ics.uci.edu/ml/datasets/daily+demand+forecasting+orders" rel="noopener noreferrer"&gt;UCI Machine Learning Repository&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Connecting your Database to MindsDB.
&lt;/h2&gt;

&lt;p&gt;To establish a database connection we will access MindsDB's GUI. MindsDB has a SQL Editor on Cloud and local via the URL 127.0.0.1:47334/. MindsDB enables connections to your favorite databases, data warehouses, data lakes, via the &lt;a href="https://docs.mindsdb.com/sql/create/databases/" rel="noopener noreferrer"&gt;CREATE DATABASE&lt;/a&gt; syntax.&lt;/p&gt;

&lt;p&gt;First, we need to connect MindsDB to the database where the Supply Chain data is stored:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access MindsDB GUI on either cloud or the URL 127.0.0.1:47334/&lt;/li&gt;
&lt;li&gt;On the default page, select the button Add Data or alternatively select the plug icon on the left sidebar.&lt;/li&gt;
&lt;li&gt;The 'Select your data source' page will populate for you to choose your database type. For this tutorial we will be selecting the postgres database button.&lt;/li&gt;
&lt;/ul&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%2Fm7qmwgqvwse6crj0aksl.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%2Fm7qmwgqvwse6crj0aksl.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once you have selected the database type,the page will automatically navigate to the SQL Editor where the syntax to create a database connection will automatically populate for you to enter the required parameters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The required parameters are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CREATE DATABASE display_name  --- display name for database. &lt;/li&gt;
&lt;li&gt;WITH ENGINE = "postgres",     --- name of the mindsdb handler &lt;/li&gt;
&lt;li&gt;PARAMETERS = {

&lt;ul&gt;
&lt;li&gt;"user": " ",              --- Your database user.&lt;/li&gt;
&lt;li&gt;"password": " ",          --- Your password.&lt;/li&gt;
&lt;li&gt;"host": " ",              --- host, it can be an ip or an url. &lt;/li&gt;
&lt;li&gt;"port": "5432",           --- common port is 5432.&lt;/li&gt;
&lt;li&gt;"database": " "           --- The name of your database *optional.
} &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&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%2Fat6n4gm5lz9hry3afh1j.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%2Fat6n4gm5lz9hry3afh1j.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the &lt;code&gt;Run&lt;/code&gt; button or Shift+Enter to execute the syntax. Once the Database connection is created the console will display a message 'Query successfully completed'.&lt;br&gt;
​&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please note that some database connections require running a Ngrok tunnel to establish a connection.&lt;br&gt;
Run the ngrok command in a terminal:&lt;/p&gt;


&lt;pre class="highlight shell"&gt;&lt;code&gt;ngrok tcp &lt;span class="o"&gt;[&lt;/span&gt;db-port]
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;for example,if your port number is 5433 you will see a similar output:&lt;/p&gt;


&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;Session Status                online
Account                       myaccount (Plan: Free)
Version                       2.3.40
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
&lt;/span&gt;&lt;span class="gp"&gt;Forwarding                    tcp://6.tcp.ngrok.io:14789 -&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;localhost:5433
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;The forwarded address information will be required when connecting to MindsDB's GUI. Select and copy the 'Forwarding' information, in this case it is &lt;code&gt;6.tcp.ngrok.io:14789&lt;/code&gt;, where 6.tcp.ngrok.io will be used for the host parameter and 14789 as the port number.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once the database integration is successful we can query the table from the database to ensure the data pulls through on MindsDB.&lt;/p&gt;

&lt;p&gt;You can run queries directly on your database. The below is an example of the syntax used:&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;example_db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datasource&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;table_name&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;We will run the query to preview the data:&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_predictions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;demand&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://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%2Fkyysyuc8u1bc7qw6iv9z.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%2Fkyysyuc8u1bc7qw6iv9z.png" alt="Image description"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding the data.
&lt;/h3&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;Week_of_the_month&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Day_of_the_week&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Non_urgent_order&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Urgent_order&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Order_type_A&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Order_type_B&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Order_type_C&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Fiscal_sector_orders&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Orders_from_the_traffic_controller_sector&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Banking_orders1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Banking_orders2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Banking_orders_3&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Target&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="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;               &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;171&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;297&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;127&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;667&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;542&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;113&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;294&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;162&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;284&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;               &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;156&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                                     &lt;span class="mi"&gt;49971&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;33703&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;69054&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;            &lt;span class="mi"&gt;18423&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="mi"&gt;317&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt;                 &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;               &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;532&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;113&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;526&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;37&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;679&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;618&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;116&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;459&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                                     &lt;span class="mi"&gt;48534&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;19646&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;16411&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;            &lt;span class="mi"&gt;20257&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;210&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;517&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt;                 &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;               &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;110&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;925&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;        &lt;span class="mi"&gt;96&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;36&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;792&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;704&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;125&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;868&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                 &lt;span class="mi"&gt;79&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                                     &lt;span class="mi"&gt;52042&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;            &lt;span class="mi"&gt;8773&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;47522&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;            &lt;span class="mi"&gt;24966&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;207&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;364&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt;                 &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;               &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;144&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;124&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;118&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;919&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;43&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;304&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;66&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;371&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;153&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;368&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;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                                     &lt;span class="mi"&gt;46573&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;33597&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;48269&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;            &lt;span class="mi"&gt;20973&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;263&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;043&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt;                 &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;               &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="mi"&gt;119&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;379&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;113&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;87&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;38&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;584&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;       &lt;span class="mi"&gt;85&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;961&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;      &lt;span class="mi"&gt;124&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;413&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;               &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;709&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;                                     &lt;span class="mi"&gt;35033&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;26278&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="mi"&gt;56665&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;            &lt;span class="mi"&gt;18502&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;248&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;958&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;p&gt;Where:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Column&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Data Type&lt;/th&gt;
&lt;th&gt;Usage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Week_of_the_month&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The how manyth week of the month it is &lt;code&gt;[1,2,3,4,5]&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Day_of_the_week&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;What day of the week it is, Monday to Friday &lt;code&gt;[1,2,3,4,5,6]&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Non_urgent_order&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders that are not urgent/emergency.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Urgent_order&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders that are an emergency to deliver.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Order_type_A&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders categorized under type A.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Order_type_B&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders categorized under type B.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Order_type_C&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders categorized under type A.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Fiscal_sector_orders&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders that are for the Fiscal sector.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Orders_from_the_traffic_controller_sector&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders from the traffic controller sector&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Banking_orders1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders categorized under Banking_orders1.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Banking_orders2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders categorized under Banking_orders2.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Banking_orders3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Orders categorized under Banking_orders3.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Target&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The total orders in demand.&lt;/td&gt;
&lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Label&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;A &lt;strong&gt;label&lt;/strong&gt; is the thing we're predicting—the y variable in simple linear regression.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;A &lt;strong&gt;feature&lt;/strong&gt; is an input variable—the x variable in simple linear regression.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Creating a Machine Learning Predictive model.
&lt;/h2&gt;

&lt;p&gt;To make predictions, we will create a machine learning model using the &lt;a href="https://docs.mindsdb.com/sql/create/predictor/" rel="noopener noreferrer"&gt;&lt;code&gt;CREATE PREDICTOR&lt;/code&gt;&lt;/a&gt; statement and make a Regression prediction.&lt;br&gt;
In the syntax we will specify which columns/ features to use for training and what column the model should learn to predict as our target/label. In this case we will select all the data to train with and use the column 'Target' as our target variable/label that we want to predict.&lt;/p&gt;

&lt;p&gt;In the SQL Editor, the below syntax will be executed:&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;supply_demand&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb_predictions&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="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;demand&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;Target&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Select the &lt;code&gt;Run&lt;/code&gt; button or Shift+Enter to execute the syntax. If there are no issues with creating the query you will receive the message in the console &lt;strong&gt;'Query successfully completed'.&lt;/strong&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%2Fyo3cva63p54qxmln1wue.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%2Fyo3cva63p54qxmln1wue.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The model can take a while to train. The status of the model's training can be checked with the below 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;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;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;'supply_demand'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the model is finished training,the status will show complete. Below you can see that the model has an accuracy of 99%.&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%2Fgo0cn3p8evblrn5c8s0b.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%2Fgo0cn3p8evblrn5c8s0b.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The Predictor Status Must be 'complete' Before Making a Prediction&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;p&gt;When the status of the predictor shows complete, we can go ahead and make a prediction. Predictions are made using the &lt;a href="https://docs.mindsdb.com/sql/api/select/" rel="noopener noreferrer"&gt;&lt;code&gt;SELECT&lt;/code&gt;&lt;/a&gt; statement by querying the predictor as if it is a table. We will provide the features with parameters to get a result.&lt;/p&gt;

&lt;p&gt;The below syntax will be used to make a prediction:&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;Target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Target_explain&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;supply_demand&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;Week_of_the_month&lt;/span&gt;&lt;span class="o"&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;Day_of_the_week&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; 
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Non_urgent_order&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;633&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Urgent_order&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;96&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;042&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Order_type_A&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;38&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;058&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Order_type_B&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;037&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Order_type_C&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;130&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;580&lt;/span&gt; 
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Fiscal_sector_orders&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;Orders_from_the_traffic_controller_sector&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;40419&lt;/span&gt; 
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Banking_orders1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;21399&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Banking_orders2&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;89461&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;Banking_orders_3&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;7679&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the above syntax and you will see the below results:&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%2Fj0jari3x85q8s5xneah1.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%2Fj0jari3x85q8s5xneah1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The model predicted that with these parameters provided the result for the total orders that will be demanded is 235.725 and by using &lt;code&gt;Target_explain&lt;/code&gt; we can see the confidence levels which shows that the confidence_lower_bound is 223.9888 and confidence_higher_bound is 247.463. This lays out that the logistics company should plan for a demand of 224-248 orders.&lt;/p&gt;

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

&lt;p&gt;The model can also make batch predictions using the &lt;a href="https://docs.mindsdb.com/sql/api/join/" rel="noopener noreferrer"&gt;&lt;code&gt;JOIN&lt;/code&gt;&lt;/a&gt; clause:&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;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Target&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;total_orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Target&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;predicted_orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Week_of_the_month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Day_of_the_week&lt;/span&gt; 
&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Non_urgent_order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Urgent_order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Order_type_A&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Order_type_B&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Order_type_C&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fiscal_sector_orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Orders_from_the_traffic_controller_sector&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Banking_orders1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Banking_orders2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Banking_orders_3&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;mindsdb_predictions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;demand&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="k"&gt;JOIN&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;supply_demand&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;b&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;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;total_orders&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;predicted_orders&lt;/span&gt;   &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Week_of_the_month&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Day_of_the_week&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Non_urgent_order&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Urgent_order&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Order_type_A&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Order_type_B&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Order_type_C&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Fiscal_sector_orders&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Orders_from_the_traffic_controller_sector&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Banking_orders1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Banking_orders2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;Banking_orders_3&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="mi"&gt;317&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;322&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1392172468534&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;                 &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;               &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;171&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;297&lt;/span&gt;          &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;127&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;667&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;542&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;113&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;294&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;162&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;284&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;156&lt;/span&gt;               &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;49971&lt;/span&gt;                                     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;33703&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;69054&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;18423&lt;/span&gt;            &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;210&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;517&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;206&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;24671425495697&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;                 &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;               &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;532&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;113&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;526&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;37&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;679&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;618&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;116&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;459&lt;/span&gt;                &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;48534&lt;/span&gt;                                     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;19646&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;16411&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;20257&lt;/span&gt;            &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;207&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;364&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;202&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;6728809487407&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;                 &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;               &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;110&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;925&lt;/span&gt;          &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;96&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;36&lt;/span&gt;        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;792&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;704&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;125&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;868&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;79&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;                 &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;52042&lt;/span&gt;                                     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;8773&lt;/span&gt;            &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;47522&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;24966&lt;/span&gt;            &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;263&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;043&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;261&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;41091237022783&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;                 &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;               &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;144&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;124&lt;/span&gt;          &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;118&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;919&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;43&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;304&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;66&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;371&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;153&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;368&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;0&lt;/span&gt;                  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;46573&lt;/span&gt;                                     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;33597&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;48269&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;20973&lt;/span&gt;            &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;248&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;958&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0993082475708&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;                 &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;               &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;119&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;379&lt;/span&gt;          &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;113&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;87&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;38&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;584&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;85&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;961&lt;/span&gt;       &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;124&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;413&lt;/span&gt;      &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;709&lt;/span&gt;               &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;35033&lt;/span&gt;                                     &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;26278&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;56665&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;18502&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;p&gt;Want to try it out for yourself? Sign up for a &lt;a href="https://cloud.mindsdb.com/signup?utm_medium=community&amp;amp;utm_source=ext.%20blogs&amp;amp;utm_campaign=blog-crop-detection" rel="noopener noreferrer"&gt;free MindsDB account&lt;/a&gt; and join our community!&lt;br&gt;
Engage with MindsDB community on &lt;a href="https://join.slack.com/t/mindsdbcommunity/shared_invite/zt-o8mrmx3l-5ai~5H66s6wlxFfBMVI6wQ" rel="noopener noreferrer"&gt;Slack&lt;/a&gt; or &lt;a href="https://github.com/mindsdb/mindsdb/discussions" rel="noopener noreferrer"&gt;Github&lt;/a&gt; to ask questions, share and express ideas and thoughts!&lt;/p&gt;

&lt;p&gt;Make sure to check out the official website of &lt;a href="https://mindsdb.com/" rel="noopener noreferrer"&gt;MindsDB&lt;/a&gt;. For more check out other &lt;a href="https://docs.mindsdb.com/" rel="noopener noreferrer"&gt;tutorials and MindsDB documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>mindsdb</category>
      <category>sql</category>
    </item>
    <item>
      <title>MindsDB: Your introduction to creating machine learning predictive models.</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Wed, 19 Jan 2022 13:25:23 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/mindsdb-your-introduction-to-creating-machine-learning-predictive-models-12d3</link>
      <guid>https://forem.com/chandrevdw31/mindsdb-your-introduction-to-creating-machine-learning-predictive-models-12d3</guid>
      <description>&lt;p&gt;Community Author: &lt;a href="https://github.com/chandrevdw31" rel="noopener noreferrer"&gt;Chandre Tosca Van Der Westhuizen&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Making Data Science Easier-
&lt;/h1&gt;

&lt;h2&gt;
  
  
  ML Classification has gotten easier with MindsDB. Has the data science world been missing out?
&lt;/h2&gt;

&lt;p&gt;Many think AI/machine learning is complicated. Turns out not all frameworks are &lt;em&gt;that&lt;/em&gt; complex.&lt;/p&gt;

&lt;p&gt;MindsDB's Classification model makes it easy to predict outcomes and can add value to many industries. We will focus on something as simple as &lt;strong&gt;mushrooms&lt;/strong&gt; to showcase the ingenuity of this In-Database Machine Learning platform. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Mushrooms&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Dataset: &lt;a href="https://www.kaggle.com/uciml/mushroom-classification" rel="noopener noreferrer"&gt;Mushrooms&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Mushrooms are a fleshy sporocarp of fungi which can either be edible or poisonous. It's usage dates back centuries with ancient Greek, Chinese and African cultures. They can have high nutritional value and medicinal properties which provides great health benefits. On the other side,some of these fungi can be toxic and consuming the wrong mushroom can have deadly consequences. It is important for industries across the world, like the food and health sector, to identify which type of mushrooms are edible and which are poisonous.&lt;/p&gt;

&lt;p&gt;We will explore how MindsDB's machine learning predictive model can make it easier classifying mushrooms and predicting which is safe to consume and which can make you ill.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;p&gt;For this tutorial, ensure you have access to docker Docker. A &lt;code&gt;docker-compose.yml&lt;/code&gt; file will be provided to get you started quickly.&lt;/p&gt;

&lt;p&gt;To ensure you can complete all the steps, make sure you have access to the following tools:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A MindsDB instance. Check out the installation guide for &lt;a href="https://docs.mindsdb.com/deployment/docker/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; or &lt;a href="https://docs.mindsdb.com/deployment/pypi/" rel="noopener noreferrer"&gt;PyPi&lt;/a&gt;. You can also use &lt;a href="https://docs.mindsdb.com/deployment/cloud/" rel="noopener noreferrer"&gt;MindsDB Cloud&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Downloaded the dataset. You can get it from &lt;a href="https://www.kaggle.com/uciml/mushroom-classification" rel="noopener noreferrer"&gt;Kaggle&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Optional: Access to ngrok. You can check the installation details at the &lt;a href="https://ngrok.com/" rel="noopener noreferrer"&gt;ngrok website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Optional- Recommended : &lt;a href="https://visualstudio.microsoft.com/downloads/" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Docker
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a new project directory named e.g. &lt;code&gt;mindsdb-tutorial&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Inside your project directory:
2.1 Create a new file named &lt;code&gt;docker-compose.yml&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Open the &lt;code&gt;docker-compose.yml&lt;/code&gt; file with any text-editor, copy the following and save.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;
version: '3.5'

services:
  postgres:
    container_name: mindsdb_postgres_mushrooms
    image: postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: changeme
      POSTGRES_DB: Mushrooms
      PGDATA: /data/postgres
    volumes:
    # persist data storage in a docker container
      - mindsdb_postgres_mushrooms:/data/postgres
    ports:
      - "5433:5432"
    network_mode: bridge
    &lt;span class="c"&gt;# restart: none&lt;/span&gt;


volumes:
    mindsdb_postgres_mushrooms:

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This compose stack features both a Postgres database running on ports 5433 and 5432 respectively. We will install Python libraries and use python code in a Jupyter Notebook to create a Postgress database and load data into it in Visual Studio.&lt;br&gt;
For the database to connect to MindsDB we will use a tunneling program ngrok to allow the remote database connection without exposing your public IP.&lt;/p&gt;

&lt;p&gt;Data will be loaded from a csv file using the import tool.&lt;br&gt;
&lt;a href="https://docs.docker.com/storage/volumes/" rel="noopener noreferrer"&gt;Docker Volumes&lt;/a&gt; are used for persistent storage of data.&lt;/p&gt;

&lt;p&gt;To run, open a terminal in the project folder and run &lt;code&gt;docker-compose up -d&lt;/code&gt; .&lt;br&gt;
If you do not have the Docker images locally, it will first download them from docker hub and might take.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a database
&lt;/h2&gt;

&lt;p&gt;The goal of creating a database in Visual Studio is to simplify the method used. We have two options- to create a python file with the relevant code in it or create a Jupyter Notebook. For the purpose of this exercise we are going to use Jupyter Notebook which will help execute the code.&lt;/p&gt;

&lt;p&gt;We will use the libraries &lt;code&gt;sqlalchemy&lt;/code&gt; and &lt;code&gt;pandas&lt;/code&gt; to create the database and load data into tables.&lt;/p&gt;

&lt;p&gt;To install the required Python libraries In a terminal, run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;sqlalchemy pandas
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Please change the pip command if required for your system i.e. pip or python3 -m pip&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To install psycopg, run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;psycopg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Visual studio, create a new file with the extension '.ipynb' to create a Jupyter Notebook. Alternatively you can open a text editor and save the following code as a python file.&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="c1"&gt;# engine = create_engine('sqlite:///college.db', echo = True)
&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;postgres&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;changeme&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Mushrooms&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;tablename&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;mushrooms&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;# database connection
&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="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;postgresql+psycopg2://&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;username&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;@localhost:5433/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;db&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="n"&gt;isolation_level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SERIALIZABLE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;file_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;./mushrooms.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Drop rows with nul values and and store data to table.&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;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropna&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inplace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tablename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;con&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;if_exists&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;replace&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are using a python file,open a terminal and execute &lt;code&gt;python3&lt;/code&gt; to run the code. If you are using Jupytor Notebook you can run the code by selecting the play buttons next to the cell blocks. Select python3 when prompted.&lt;/p&gt;

&lt;p&gt;The dataset consists of the following information:&lt;/p&gt;

&lt;p&gt;Attribute Information: (classes: edible=e, poisonous=p)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*cap-shape: bell=b,conical=c,convex=x,flat=f, knobbed=k,sunken=s
*cap-surface: fibrous=f,grooves=g,scaly=y,smooth=s
*cap-color: brown=n,buff=b,cinnamon=c,gray=g,green=r,pink=p,purple=u,red=e,white=w,yellow=y
*bruises: bruises=t,no=f
*odor: almond=a,anise=l,creosote=c,fishy=y,foul=f,musty=m,none=n,pungent=p,spicy=s
*gill-attachment: attached=a,descending=d,free=f,notched=n
*gill-spacing: close=c,crowded=w,distant=d
*gill-size: broad=b,narrow=n
*gill-color: black=k,brown=n,buff=b,chocolate=h,gray=g, green=r,orange=o,pink=p,purple=u,red=e,white=w,yellow=y
*stalk-shape: enlarging=e,tapering=t
*stalk-root: bulbous=b,club=c,cup=u,equal=e,rhizomorphs=z,rooted=r,missing=?
*stalk-surface-above-ring: fibrous=f,scaly=y,silky=k,smooth=s
*stalk-surface-below-ring: fibrous=f,scaly=y,silky=k,smooth=s
*stalk-color-above-ring: brown=n,buff=b,cinnamon=c,gray=g,orange=o,pink=p,red=e,white=w,yellow=y
*stalk-color-below-ring: brown=n,buff=b,cinnamon=c,gray=g,orange=o,pink=p,red=e,white=w,yellow=y
*veil-type: partial=p,universal=u
*veil-color: brown=n,orange=o,white=w,yellow=y
*ring-number: none=n,one=o,two=t
*ring-type: cobwebby=c,evanescent=e,flaring=f,large=l,none=n,pendant=p,sheathing=s,zone=z
*spore-print-color: black=k,brown=n,buff=b,chocolate=h,green=r,orange=o,purple=u,white=w,yellow=y
*population: abundant=a,clustered=c,numerous=n,scattered=s,several=v,solitary=y
*habitat: grasses=g,leaves=l,meadows=m,paths=p,urban=u,waste=w,woods=d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Accessing the Postgres Database
&lt;/h2&gt;

&lt;p&gt;To access the postgres database, add the extension &lt;em&gt;Postgres Management Tool&lt;/em&gt; by Chris Kolkman v1.1.19 in Visual studio.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;A shortcut is to select Ctrl+Shift+X and search for the management tool.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&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%2Fcvde9qcukmf748xrj6hl.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%2Fcvde9qcukmf748xrj6hl.png" alt="database"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Connecting to the database
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;On the sidebar of visual studio, select the icon for the Postgress explorer.&lt;/li&gt;
&lt;li&gt;Select the + button by the option POSTGRESQL EXPLORER:POSTGRESQL to add a database connection.&lt;/li&gt;
&lt;li&gt;Add the hostname of the database.
&amp;gt;For this example, 127.0.0.1 was used.&lt;/li&gt;
&lt;li&gt;Enter the PostgreSQL user to authenticate. 
&amp;gt;For this example it is postgres.&lt;/li&gt;
&lt;li&gt;Enter the password of the PostgreSQL user.&lt;/li&gt;
&lt;li&gt;Add the port number. 
&amp;gt;For this example 5433 was used.&lt;/li&gt;
&lt;li&gt;Select the type of connection to use- use Secure Connection or Standard Connection. 
&amp;gt;For this example we used Standard Connection.&lt;/li&gt;
&lt;li&gt;Add the name of the Database to connect to. 
&amp;gt;For this example Mushrooms was used.&lt;/li&gt;
&lt;li&gt;Add the connection name.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can test the database by navigating to the Postgres Management Tool, selecting the hostname and database dropdowns , then right click on the table name  and choose between the select options to return the values.&lt;/p&gt;
&lt;h2&gt;
  
  
  Connecting to MindsDB Cloud
&lt;/h2&gt;

&lt;p&gt;We will now connect our database to MindsDB Cloud.&lt;/p&gt;

&lt;p&gt;First, we will run the &lt;code&gt;ngrok&lt;/code&gt; command to establish a connection. Open a terminal and run the following command.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ngrok tcp &lt;span class="o"&gt;[&lt;/span&gt;db-port]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this example the port number used is 5433.&lt;/p&gt;

&lt;p&gt;You should see a similar output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;Session Status                online
Account                       myaccount (Plan: Free)
Version                       2.3.40
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
&lt;/span&gt;&lt;span class="gp"&gt;Forwarding                    tcp://6.tcp.ngrok.io:14789 -&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;localhost:5433
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The forwarded address information will be required when connecting to MindsDB's GUI. Select and copy the 'Forwarding' information, in this case it is &lt;code&gt;6.tcp.ngrok.io:14789&lt;/code&gt;, and keep this information for later.&lt;/p&gt;

&lt;p&gt;For the next steps we will log into the MindsDB cloud interface. MindsDB Cloud is perfect if you are unable to install MindsDB on your device. If you are not registered yet, feel free to follow the below guide. If you have already registered, skip the next steps to connect your database.&lt;/p&gt;

&lt;h3&gt;
  
  
  MindsDB Studio Cloud Set Up
&lt;/h3&gt;

&lt;p&gt;You can visit this &lt;a href="https://docs.mindsdb.com/deployment/cloud/" rel="noopener noreferrer"&gt;link&lt;/a&gt; and follow the steps in registering a MindsDB Cloud account.&lt;/p&gt;

&lt;p&gt;On the landing page, navigate to the left corner of the screen and select &lt;code&gt;ADD DATABASE&lt;/code&gt;. Enter the required details. &lt;/p&gt;

&lt;p&gt;Too see an example, click &lt;a href="https://docs.mindsdb.com/connect/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Connect&lt;/code&gt;, you should now see your Postgres database connection in the main screen.&lt;/p&gt;

&lt;p&gt;You are now done with connecting MindsDB to your database!&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a predictor
&lt;/h2&gt;

&lt;p&gt;Now we are ready to create our own predictor. We will start by using the MySQL API to connect to MindsDB and with a single SQL command create a predictor.&lt;/p&gt;

&lt;p&gt;The predictor we will create will be trained to determine if a mushroom is edible or poisonous.&lt;/p&gt;

&lt;p&gt;Using the following command, you will connect through the MySQL API to MindsDB.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please note that the username and password to use will be the credentials you registered your MindsDB account with.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mysql &lt;span class="nt"&gt;-h&lt;/span&gt; cloud.mindsdb.com &lt;span class="nt"&gt;--port&lt;/span&gt; 3306 &lt;span class="nt"&gt;-u&lt;/span&gt; cloudusername@mail.com &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F40mfx3iot8p1sg165h9g.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%2F40mfx3iot8p1sg165h9g.png" alt="client"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are successfully connected, make sure you connect to MindsDB's database.&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;USE&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the following query to create a predictor that will predict the &lt;code&gt;target_class&lt;/code&gt; for the specific field 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="n"&gt;mysql&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="n"&gt;PREDICTOR&lt;/span&gt; &lt;span class="n"&gt;mushroom_predictor&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Mushrooms&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="nv"&gt;"mushrooms"&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;mushrooms_data&lt;/span&gt;
&lt;span class="n"&gt;PREDICT&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After creating the predictor you should see a similar output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;Query OK, 0 rows affected (12.18 sec)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The predictor was created successfully and has started training. To check the status of the model, use the below query.&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;mysql&lt;/span&gt;&lt;span class="o"&gt;&amp;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;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;'mushroom_predictor'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the predictor has finished training, you will see a similar output. Note that MindsDB does model testing for you automatically, so you will immediately see if the predictor is accurate enough.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;+--------------------+----------+----------+---------+---------------+-----------------+-------+-------------------+------------------+
| name               | status   | accuracy | predict | update_status | mindsdb_version | error | select_data_query | training_options |
+--------------------+----------+----------+---------+---------------+-----------------+-------+-------------------+------------------+
| mushroom_predictor | complete | 1.0      | class   | up_to_date    | 2.61.0          | NULL  |                   |                  |
+--------------------+----------+----------+---------+---------------+-----------------+-------+-------------------+------------------+
1 row in set (0.61 sec)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The predictor has completed its training, indicated by the status column, and shows the accuracy of the model.&lt;br&gt;
You can revisit training new predictors to increase accuracy by changing the query to better suit the dataset i.e. omitting certain columns etc.&lt;/p&gt;

&lt;p&gt;Good job! We have successfully created and trained a predictive model ✨&lt;/p&gt;
&lt;h2&gt;
  
  
  Make predictions
&lt;/h2&gt;

&lt;p&gt;In this section you will learn how to make predictions using your trained model.&lt;br&gt;
Now we will use the trained model to make predictions using a SQL query&lt;/p&gt;

&lt;p&gt;Use the following query using mock data with the predictor.&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="k"&gt;class&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;mushroom_predictor&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;when_data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'{"cap-shape": "x","cap-surface": "s","cap-color": "n","bruises": "t","odor": "p","gill-attachment": "f","gill-spacing": "c","gill-size": "n","gill-color": "k","stalk-shape": "e","stalk-root": "e","stalk-surface-above-ring": "s","stalk-surface-below-ring": "s","stalk-color-above-ring": "w","stalk-color-below-ring": "w","veil-type": "p","veil-color": "w","ring-number": "o","ring-type": "p","spore-print-color": "k","population": "s","habitat": "u"}'&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="k"&gt;G&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;*************************** 1. row ***************************
class: p
1 row in set (1.19 sec)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have successfully created and trained a model that can predict if a model is edible or poisonous.&lt;/p&gt;

&lt;p&gt;Want to try it out for yourself? Sign up for a &lt;a href="https://cloud.mindsdb.com/signup?utm_medium=community&amp;amp;utm_source=ext.%20blogs&amp;amp;utm_campaign=blog-crop-detection" rel="noopener noreferrer"&gt;free MindsDB account&lt;/a&gt; and join our community!&lt;br&gt;
Engage with MindsDB community on &lt;a href="https://join.slack.com/t/mindsdbcommunity/shared_invite/zt-o8mrmx3l-5ai~5H66s6wlxFfBMVI6wQ" rel="noopener noreferrer"&gt;Slack&lt;/a&gt; or &lt;a href="https://github.com/mindsdb/mindsdb/discussions" rel="noopener noreferrer"&gt;Github&lt;/a&gt; to ask questions, share and express ideas and thoughts!&lt;/p&gt;

&lt;p&gt;For more check out other &lt;a href="https://docs.mindsdb.com/" rel="noopener noreferrer"&gt;tutorials and MindsDB documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>mindsdb</category>
    </item>
    <item>
      <title>MindsDB: Creating machine learning predictive models using SQL.</title>
      <dc:creator>Chandre Van Der Westhuizen</dc:creator>
      <pubDate>Wed, 19 Jan 2022 12:26:44 +0000</pubDate>
      <link>https://forem.com/chandrevdw31/mindsdb-creating-machine-learning-predictive-models-using-sql-4gk7</link>
      <guid>https://forem.com/chandrevdw31/mindsdb-creating-machine-learning-predictive-models-using-sql-4gk7</guid>
      <description>&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%2Fgithub.com%2Fmindsdb%2Fmindsdb%2Fblob%2Fstaging%2Fdocs%2Fmindsdb-docs%2Fdocs%2Fassets%2Ftutorials%2Fdiabetes%2Fpg4admin%2Fimages.png%3Fraw%3Dtrue" 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%2Fgithub.com%2Fmindsdb%2Fmindsdb%2Fblob%2Fstaging%2Fdocs%2Fmindsdb-docs%2Fdocs%2Fassets%2Ftutorials%2Fdiabetes%2Fpg4admin%2Fimages.png%3Fraw%3Dtrue"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h1&gt;&lt;strong&gt;How AI can help identify diabetic risk.&lt;/strong&gt;&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Dataset:&lt;a href="https://github.com/mindsdb/mindsdb-examples/blob/a43f66f0250c460c0c4a0793baa941307b09c9f2/others/diabetes_example/dataset/diabetes-train.csv" rel="noopener noreferrer"&gt;Diabetes Data&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Communtiy Author: &lt;a href="https://github.com/chandrevdw31" rel="noopener noreferrer"&gt;Chandre Tosca Van Der Westhuizen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Diabetes is a metabolic disease that causes high blood sugar and if left untreated can damage your nerves, eyes, kidneys and other organs. It is known as a silent killer, as recent studies have shown that by the year 2040 the world's diabetic patients will reach 642 million. The need to analyse vast medical data to assist in the diagnoses, treatment and management of illnesses is increasing for the medical community. With the rapid development of machine learning, it has been applied to many aspects of medical health and is transforming the health care system.&lt;/p&gt;

&lt;p&gt;The vitality to intelligently transform information into valuable knowledge through machine learning has become more present in biosciences. With the use of predictive models, MindsDB can assist in classifying diabetic and non-diabetic patients or those who pose a high risk. This is just a small showcase on how MindsDB's machine learning will be able to assist in vastly enhancing the reach of illnesses, thereby making it more efficient and can revolutionize businesses and most importantly the health care system.&lt;/p&gt;

&lt;p&gt;In this tutorial we will be exploring how we can use a machine learning model to classify negative and positive cases for diabetes.&lt;br&gt;
&lt;strong&gt;MindsDB&lt;/strong&gt; allows you to train your model from CSV data directly, however for this tutorial you will:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create &amp;amp; setup a new database.&lt;/li&gt;
&lt;li&gt;Load sample data into a table using the PGAdmin GUI Tool.&lt;/li&gt;
&lt;li&gt;Allow connections to the database using Ngrok.&lt;/li&gt;
&lt;li&gt;Setup a MindsDB connection to your local instance.&lt;/li&gt;
&lt;li&gt;Create a predictor using SQL.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;p&gt;For this tutorial, Docker is highly recommended. A &lt;code&gt;docker-compose.yml&lt;/code&gt; file will be provided to get you started quickly.&lt;/p&gt;

&lt;p&gt;To ensure you can complete all the steps, make sure you have access to the following tools:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A MindsDB instance. Check out the installation guide for &lt;a href="https://docs.mindsdb.com/deployment/docker/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; or &lt;a href="https://docs.mindsdb.com/deployment/pypi/" rel="noopener noreferrer"&gt;PyPi&lt;/a&gt;. You can also use &lt;a href="https://docs.mindsdb.com/deployment/cloud/" rel="noopener noreferrer"&gt;MindsDB Cloud&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Optional: A PostgreSQL Database. You can install it &lt;a href="https://www.postgresql.org/download/" rel="noopener noreferrer"&gt;locally&lt;/a&gt; or through &lt;a href="https://hub.docker.com/_/postgres" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Downloaded the dataset. You can get it from &lt;a href="https://github.com/mindsdb/mindsdb-examples/blob/a43f66f0250c460c0c4a0793baa941307b09c9f2/others/diabetes_example/dataset/diabetes-train.csv" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Access to PGAdmin4 (provided with the docker-compose file).&lt;/li&gt;
&lt;li&gt;Optional: Access to ngrok. You can check the installation details at the &lt;a href="https://ngrok.com/" rel="noopener noreferrer"&gt;ngrok website&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Docker
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a new project directory named e.g. &lt;code&gt;mindsdb-tutorial&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Inside your project directory:&lt;/p&gt;

&lt;p&gt;2.1 Create a new file named &lt;code&gt;docker-compose.yml&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;2.2 Create another directory named &lt;code&gt;data&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;2.3 Download the CSV datafile and store it in your directory&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Open the &lt;code&gt;docker-compose.yml&lt;/code&gt; file with any text-editor, copy the following and save.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;
version: '3.5'

services:
  postgres:
    container_name: postgres_container
    image: postgres
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-postgres}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
      PGDATA: /data/postgres
    volumes:
       - postgres:/data/postgres
    ports:
      - "5432:5432"
    network_mode: bridge
    restart: unless-stopped

  pgadmin:
    container_name: pgadmin_container
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
      PGADMIN_CONFIG_SERVER_MODE: 'False'
    volumes:
       - pgadmin:/var/lib/pgadmin
       &lt;span class="c"&gt;# Mounts local dir to docker container&lt;/span&gt;
       - ./data:/home

    ports:
      - "5050:80"
    network_mode: bridge
    restart: unless-stopped

volumes:
    postgres:
    pgadmin:


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This compose stack features both a Postgres database with PGAdmin4 running on ports 5432 and 5050 respectively.&lt;br&gt;
For the database to connect to MindsDB we will use a tunneling program Ngrok to allow the remote database connection without exposing your public IP.&lt;/p&gt;

&lt;p&gt;Data will be loaded from a csv file using the import tool.&lt;br&gt;
&lt;a href="https://docs.docker.com/storage/volumes/" rel="noopener noreferrer"&gt;Docker Volumes&lt;/a&gt; are used for persistent storage of data.&lt;/p&gt;

&lt;p&gt;To run, open a terminal in the project folder and run &lt;code&gt;docker-compose up -d&lt;/code&gt; .&lt;br&gt;
If you do not have the Docker images locally, it will first download them from docker hub and might take.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setup the database
&lt;/h2&gt;

&lt;p&gt;After docker has started all the services&lt;br&gt;
In this section, you will create a Postgres database and a table into which you will then load the dataset.&lt;/p&gt;

&lt;p&gt;First, connect to your Postgres instance. There are cli options like &lt;a href="https://www.pgcli.com/" rel="noopener noreferrer"&gt;pgcli&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We will use a gui manager: &lt;strong&gt;pgAdmin&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The required details are specified within the compose file. Remember to change the username &amp;amp; password if you have a different one set up in.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Steps&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open your browser and enter localhost:5050 in the Navigation bar.&lt;/li&gt;
&lt;li&gt;Setup or enter a master password.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a new server connection by navigating to the right side of the page and right click on 'Server', select 'Create' and enter the required details.&lt;/p&gt;

&lt;p&gt;3.1 For the purpose of the exercise, under the General Tab the Name entered is MindsDB and the host name/address is localhost under the Connection tab.&lt;br&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%2Fmazyacuxs61ji36nbl5h.gif" 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%2Fmazyacuxs61ji36nbl5h.gif" alt="server"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To create a new database, select the dropdown of the Server and navigate to 'Databases', right click on it and select 'Create' and then 'Databases'.Enter the required details.&lt;/p&gt;

&lt;p&gt;4.1 For this exercise, the Database was given the name DIABETES_DATA under the General tab.&lt;br&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%2Fk19928f0gz2xs7q6vfeq.gif" 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%2Fk19928f0gz2xs7q6vfeq.gif" alt="database"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the dropdown of the database created, navigate to 'Schema' and right click on it to select 'Create' and then 'Schema'. Enter the required details.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the dropdown of the schema created and navigate to 'Tables' to right click on it and select 'Query Tool'. This will allow you to add a table with SQL code.The below code was used to create the table.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;Diabetes&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;Number_of_times_pregnant&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;Plasma_glucose_concentration&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Diastolic_blood_pressure&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Triceps_skin_fold_thickness&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Two_Hour_serum_insulin&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Body_mass_index&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Diabetes_pedigree_function&lt;/span&gt; &lt;span class="nb"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Age&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;Class&lt;/span&gt; &lt;span class="nb"&gt;varchar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&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;&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%2F3l3hfv5vrpa5s25za2nr.gif" 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%2F3l3hfv5vrpa5s25za2nr.gif" alt="table"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Importing The Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before you import the data, please delete the first row as it is a table header. To import rows into your table, right click on the table name and select &lt;em&gt;Import/Export&lt;/em&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Under the Options tab, ensure the slider is set to &lt;em&gt;Import&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select your file name and ensure that the delimiters are set.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fxq6tipd2u7m0bqbl8eou.gif" 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%2Fxq6tipd2u7m0bqbl8eou.gif" alt="Import rows"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Query the data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By making a select query, the data that has been loaded can be verified.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Navigate to the table name to right click and select 'SCRIPTS', then choose 'SELECT scripts'.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the below query and see the results returned.&lt;br&gt;
&lt;/p&gt;&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="nv"&gt;"DIABETES_DATA"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diabetes&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 use the below query structure to show your database&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="nv"&gt;"Schema_name"&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;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fbpbmvpvo6yxw2yvw9eq3.gif" 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%2Fbpbmvpvo6yxw2yvw9eq3.gif" alt="select"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations! You have completed setting up a Postgres database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect your database to MindsDB GUI
&lt;/h2&gt;

&lt;p&gt;Now we are ready to connect your database to MindsDB's GUI. For this exercise, we will be connecting to MindsDB Cloud as it is much more convenient for most users to use.&lt;/p&gt;

&lt;p&gt;To make our database available to MindsDB, we will run &lt;code&gt;ngrok&lt;/code&gt; as our database instance is local.&lt;/p&gt;

&lt;p&gt;The following command can be run in docker or a terminal on your device to set up a ngrok tunnel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ngrok tcp &lt;span class="o"&gt;[&lt;/span&gt;db-port]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this example the port number used is 5432.&lt;/p&gt;

&lt;p&gt;You should see a similar output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;Session Status                online
Account                       myaccount (Plan: Free)
Version                       2.3.40
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
&lt;/span&gt;&lt;span class="gp"&gt;Forwarding                    tcp://x.tcp.ngrok.io:15076 -&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;localhost:5432
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The information required is by the forwarded address, next to 'Forwarding' select and copy &lt;code&gt;x.tcp.ngrok.io:15076&lt;/code&gt;  Once you have copied the information, you can add it to the information requested by the MindsDB GUI which we will get to in a moment.&lt;/p&gt;

&lt;p&gt;For the next steps we will log into the MindsDB cloud interface. MindsDB Cloud is perfect if you are unable to install MindsDB on your device. If you are not registered yet, feel free to follow the below guide. If you have already registered, skip the next steps to connect your database.&lt;/p&gt;

&lt;h3&gt;
  
  
  MindsDB Studio Cloud Set Up
&lt;/h3&gt;

&lt;p&gt;You can visit this &lt;a href="https://docs.mindsdb.com/deployment/cloud/" rel="noopener noreferrer"&gt;link&lt;/a&gt; and follow the steps in registering a MindsDB Cloud account.&lt;/p&gt;

&lt;p&gt;On the landing page, navigate to the left corner of the screen and select &lt;code&gt;ADD DATABASE&lt;/code&gt;. Enter the required details.&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%2Furkutul6hbb8s889nzcj.gif" 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%2Furkutul6hbb8s889nzcj.gif" alt="Cloud"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Connect&lt;/code&gt;, you should now see your Postgres database connection in the main screen.&lt;/p&gt;

&lt;p&gt;You are now done with connecting MindsDB to your database! 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a predictor
&lt;/h2&gt;

&lt;p&gt;Now we are ready to create our own predictor! We will start by using the MySQL API to connect to MindsDB and with a single SQL command create a predictor.&lt;/p&gt;

&lt;p&gt;The predictor we will create will be trained to determine negative and positive cases for diabetes. Predictors are great machine learning models when working with large datasets and optimal for determining classifications.&lt;/p&gt;

&lt;p&gt;Using the following command, you will connect through the MySQL API to MindsDB.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please note that the username and password to use will be the credentials you registered your MindsDB account with.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mysql &lt;span class="nt"&gt;-h&lt;/span&gt; cloud.mindsdb.com &lt;span class="nt"&gt;--port&lt;/span&gt; 3306 &lt;span class="nt"&gt;-u&lt;/span&gt; cloudusername@mail.com &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are successfully connected, make sure you connect to MindsDB's database.&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;USE&lt;/span&gt; &lt;span class="n"&gt;mindsdb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the following query to create a predictor that will predict the &lt;code&gt;class&lt;/code&gt; (&lt;em&gt;positive or negative&lt;/em&gt;) for the specific field 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;CREATE&lt;/span&gt; &lt;span class="n"&gt;PREDICTOR&lt;/span&gt; &lt;span class="n"&gt;diabetes_predictor&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Diabetes&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="nv"&gt;"DIABETES_DATA"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diabetes&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;PREDICT&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After creating the predictor you should see a similar output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;Query OK, 0 rows affected (8.09 sec)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The predictor was created successfully and has started training. To check the status of the model, use the below query.&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;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;'diabetes_predictor'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the predictor has finished training, you will see a similar output. Note that MindsDB does model testing for you automatically, so you will immediately see if the predictor is accurate enough.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;mysql&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;SELECT &lt;span class="k"&gt;*&lt;/span&gt; FROM mindsdb.predictors WHERE &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'diabetes_predictor'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="go"&gt;+--------------------+----------+--------------------+---------+---------------+-----------------+-------+-------------------+------------------+
| name               | status   | accuracy           | predict | update_status | mindsdb_version | error | select_data_query | training_options |
+--------------------+----------+--------------------+---------+---------------+-----------------+-------+-------------------+------------------+
| diabetes_predictor | complete | 0.6546310832025117 | class   | up_to_date    | 2.61.0          | NULL  |                   |                  |
+--------------------+----------+--------------------+---------+---------------+-----------------+-------+-------------------+------------------+
1 row in set (0.57 sec)

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The predictor has completed its training, indicated by the status column, and shows the accuracy of the model.&lt;br&gt;
You can revisit training new predictors to increase accuracy by changing the query to better suit the dataset i.e. omitting certain columns etc.&lt;/p&gt;

&lt;p&gt;Good job! We have successfully created and trained a predictive model ✨&lt;/p&gt;
&lt;h2&gt;
  
  
  Make predictions
&lt;/h2&gt;

&lt;p&gt;In this section you will learn how to make predictions using your trained model.&lt;br&gt;
Now we will use the trained model to make predictions using a SQL query&lt;/p&gt;

&lt;p&gt;Use the following query using mock data with the predictor.&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="k"&gt;class&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;diabetes_predictor&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;when_data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'{"number_of_times_pregnant": 0, "plasma_glucose_concentration": 135.0, "diastolic_blood_pressure": 65.0, "triceps_skin_fold_thickness": 30, "two_Hour_serum_insulin": 0, "body_mass_index": 23.5, "diabetes_pedigree_function": 0.366, "age": 31}'&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="k"&gt;G&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;class: negative
1 row in set (0.32 sec)

*************************** 1. row ***************************

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Viola! We have successfully created and trained a model and make our own prediction. How easy and amazing is MindsDB? 🎉&lt;/p&gt;

&lt;p&gt;Want to try it out for yourself? Sign up for a &lt;a href="https://cloud.mindsdb.com/signup?utm_medium=community&amp;amp;utm_source=ext.%20blogs&amp;amp;utm_campaign=blog-crop-detection" rel="noopener noreferrer"&gt;free MindsDB account&lt;/a&gt; and join our community!&lt;br&gt;
Engage with MindsDB community on &lt;a href="https://join.slack.com/t/mindsdbcommunity/shared_invite/zt-o8mrmx3l-5ai~5H66s6wlxFfBMVI6wQ" rel="noopener noreferrer"&gt;Slack&lt;/a&gt; or &lt;a href="https://github.com/mindsdb/mindsdb/discussions" rel="noopener noreferrer"&gt;Github&lt;/a&gt; to ask questions, share and express ideas and thoughts!&lt;/p&gt;

&lt;p&gt;For more check out other &lt;a href="https://docs.mindsdb.com/" rel="noopener noreferrer"&gt;tutorials and MindsDB documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>machinelearning</category>
      <category>mindsdb</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
