<?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>DEV Community: Kamil Tyborowski</title>
    <description>The latest articles on DEV Community by Kamil Tyborowski (@ktyborowski).</description>
    <link>https://dev.to/ktyborowski</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%2F1015225%2Ff7a01774-fe8a-470a-b6a5-7c99b3caaad1.png</url>
      <title>DEV Community: Kamil Tyborowski</title>
      <link>https://dev.to/ktyborowski</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ktyborowski"/>
    <language>en</language>
    <item>
      <title>How to predict purchase intent using SQL</title>
      <dc:creator>Kamil Tyborowski</dc:creator>
      <pubDate>Sat, 28 Jan 2023 12:18:33 +0000</pubDate>
      <link>https://dev.to/ktyborowski/how-to-predict-purchase-intent-using-sql-2p9c</link>
      <guid>https://dev.to/ktyborowski/how-to-predict-purchase-intent-using-sql-2p9c</guid>
      <description>&lt;p&gt;Customer service is an essential part of any business. In the end it can determine whether a sale is made or not. Currently, most customers choose text based messaging to communicate with companies (&lt;a href="https://www.salesforce.com/resources/research-reports/state-of-service/" rel="noopener noreferrer"&gt;Salesforce&lt;/a&gt;). It does not matter if it is email or instant messaging as long as you reach customers fast and reliably. This can be especially challenging in e-commerce, where customers send thousands of messages about different products or services daily. With limited resources it's impossible to get to all customers instantly. What can help in such cases is to identify which customers should be served as soon as possible and which could wait a little longer.&lt;/p&gt;

&lt;p&gt;In this tutorial, you will learn how to use &lt;strong&gt;MindsDB&lt;/strong&gt; and a pre-trained text classification model from &lt;strong&gt;HuggingFace&lt;/strong&gt;, to carry out purchase intent prediction inside your database. All without leaving SQL thanks to the new &lt;strong&gt;Hugging Face - MindsDB integration&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;At the end, you will be able to perform the same classification on your own data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To follow along, you will need access to MindsDB. You can either install &lt;a href="https://docs.mindsdb.com/setup/self-hosted" rel="noopener noreferrer"&gt;MindsDB locally&lt;/a&gt; or start instantly with the &lt;a href="https://docs.mindsdb.com/setup/cloud" rel="noopener noreferrer"&gt;cloud based version&lt;/a&gt;. You can sign up for a &lt;a href="https://cloud.mindsdb.com/register" rel="noopener noreferrer"&gt;free account at MindsDB Cloud here&lt;/a&gt;. You also need the demo dataset. You can download it from the &lt;a href="https://registry.opendata.aws/pre-post-purchase-questions" rel="noopener noreferrer"&gt;Registry of Open Data on AWS&lt;/a&gt;. The steps in this tutorial are performed on a &lt;strong&gt;PostgreSQL&lt;/strong&gt; database, but you can use any other data source that is currently supported by MindsDB. See &lt;a href="https://docs.mindsdb.com/data-integrations/all-data-integrations" rel="noopener noreferrer"&gt;all the supported integrations here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Loading the demo data
&lt;/h2&gt;

&lt;p&gt;All queries shown in this section can be run using the &lt;code&gt;psql&lt;/code&gt; tool that comes with PostgreSQL.&lt;/p&gt;

&lt;p&gt;To begin, create the &lt;code&gt;demo&lt;/code&gt; database. You can also use an existing 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;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't forget to activate the created database.&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;\c demo
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, you need to create a table inside your database. To do so, run the following 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;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;customer_questions&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;serial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;asin&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;question&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;item_name&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;hours_diff&lt;/span&gt; &lt;span class="nb"&gt;double&lt;/span&gt; &lt;span class="nb"&gt;precision&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;label&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;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&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;The next step is to import the downloaded demo data. You can do it using the &lt;code&gt;\copy&lt;/code&gt; command available in PostgreSQL. Below is an example. Remember to replace the file path to the location where you have downloaded the dataset.&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;\copy customer_questions (asin, question, item_name, hours_diff, label) FROM 'path/to/dataset/PrePostQuestions.csv' DELIMITER ',' CSV HEADER ENCODING 'UTF8' QUOTE '\"';&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the import has finished, you can check if the data was loaded properly.&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;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customer_questions&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 console"&gt;&lt;code&gt;&lt;span class="go"&gt; id |                                                                 question
----+------------------------------------------------------------------------------------------------------------------------------------------
  1 | Are boots cold reliable?
  2 | is the main body rubber or plastic?
  3 | Do you know the thread pitch/count for the tang?
  4 | The item ordered came tarnished and my son needed it by wednesday!!! is there any way you can send a replacement as soon as possible??!!
  5 | "I purchased these and now they look weird with my stock headlights.  What headlights would ""match"" these?"
(5 rows)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything went correctly, you should see a similar output to the one above. &lt;/p&gt;

&lt;p&gt;Great! You can now move on to the next section, where you will set up the purchase intent model inside MindsDB.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Configuring the model
&lt;/h2&gt;

&lt;p&gt;To start, open the MindsDB user interface. If you are using MindsDB Cloud you can &lt;a href="https://cloud.mindsdb.com/login" rel="noopener noreferrer"&gt;log in here&lt;/a&gt;.&lt;br&gt;
There, you will see a query execution interface where you can execute your queries.&lt;/p&gt;

&lt;p&gt;Let's begin with connecting the PostgreSQL database with the MindsDB instance. Run the following query with the correct parameters for your own 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;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;demo&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="nv"&gt;"postgres"&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;"user"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;"postgres"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nv"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;"my-secret-password"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nv"&gt;"host"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;"171.174.170.81"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nv"&gt;"port"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;"5432"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nv"&gt;"database"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;"demo"&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 verify the connection by executing another  &lt;code&gt;SELECT&lt;/code&gt; query to see 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="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_questions&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;&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%2Fyz437z0hnjfsxmm36ymb.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%2Fyz437z0hnjfsxmm36ymb.png" alt="MindsDB SELECT query result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should see the same data as in the database itself.&lt;/p&gt;

&lt;p&gt;Now, let's set up the pre-trained HuggingFace purchase intent model to classify 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;CREATE&lt;/span&gt; &lt;span class="n"&gt;MODEL&lt;/span&gt; &lt;span class="n"&gt;purchase_intent_classifier&lt;/span&gt;
&lt;span class="n"&gt;PREDICT&lt;/span&gt; &lt;span class="n"&gt;label&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="nv"&gt;"huggingface"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;"text-classification"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;model_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;"j-hartmann/purchase-intention-english-roberta-large"&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="nv"&gt;"question"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depending on the size of the model, the process of creating your &lt;em&gt;AI Table&lt;/em&gt; might take a bit. So please be patient. You can check the status anytime by selecting your &lt;code&gt;MODEL&lt;/code&gt; by name from the &lt;code&gt;models&lt;/code&gt; table.&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;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;models&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;'purchase_intent_classifier'&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 know that your model is ready as soon as you see a &lt;code&gt;completed&lt;/code&gt; status.&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%2Fwskk3cu6afyo7yia4oq3.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%2Fwskk3cu6afyo7yia4oq3.png" alt="MindsDB model status"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that the classifier is trained, you can move on to the last section, where you will learn how to actually use it to detect purchase intent.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Predicting the customer purchase intent
&lt;/h2&gt;

&lt;p&gt;First, let's try out the model with an example customer message.&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;purchase_intent_classifier&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'How much does this t-shirt cost? I would like to try it on.'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below is the output of the query. As you can see, the model predicted that the question carries a purchase intent!&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%2F3pk72vc62j1igquj4oah.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%2F3pk72vc62j1igquj4oah.png" alt="MindsDB example prediction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is left is to run the classifier against the whole dataset. To run the model over all the data points, you need to use a &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;questions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;purchase_intent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_questions&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;questions&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;purchase_intent_classifier&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;purchase_intent&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%2Fan3wxnws9227ia6p2jxi.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%2Fan3wxnws9227ia6p2jxi.png" alt="MindsDB example prediction on full dataset"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the &lt;code&gt;JOIN&lt;/code&gt; clause applies the predictor on all questions from the &lt;code&gt;customer_questions&lt;/code&gt; table. The output is the corresponding purchase intent label. The label &lt;code&gt;no&lt;/code&gt; suggests that the customer does not have any purchase intent while the label &lt;code&gt;yes&lt;/code&gt; indicates that the customer is interested in purchasing.&lt;/p&gt;

&lt;p&gt;If you would like to run the prediction on a subset of the data, you can achieve that easily by adding a standard &lt;code&gt;LIMIT&lt;/code&gt; SQL 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;questions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;purchase_intent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_questions&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;questions&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;purchase_intent_classifier&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;purchase_intent&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can compose your prediction queries however you like. You just need to follow basic SQL syntax rules.&lt;/p&gt;

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

&lt;p&gt;In this tutorial, you have learned how to use MindsDB to perform purchase intent classification in customer messages. With this knowledge, you can easily start your own machine learning projects without leaving SQL. To learn more about using MindsDB with HuggingFace models check out the &lt;a href="https://docs.mindsdb.com/nlp/nlp-mindsdb-hf" rel="noopener noreferrer"&gt;NLP with MindsDB and HuggingFace section&lt;/a&gt; of the official documentation. Additionally, you can find guides for different tasks such as time-series forecasting or regression at the &lt;a href="https://docs.mindsdb.com/sql/tutorials" rel="noopener noreferrer"&gt;official&lt;/a&gt; and &lt;a href="https://docs.mindsdb.com/tutorials" rel="noopener noreferrer"&gt;community&lt;/a&gt; tutorial sections. And in case you need any help with MindsDB feel free to join the &lt;a href="https://mindsdb.com/joincommunity" rel="noopener noreferrer"&gt;MindsDB community Slack&lt;/a&gt;.&lt;/p&gt;

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