CREATE MODEL
statement.
Here we create a model that classifies sentiment of customer reviews as instructed in the prompt template message. The required input is the review and output is the sentiment predicted by the model.
amazon_reviews
table stores the following columns:
sentiment_classifier_model
, but not for the response_generator_model
.
The products_sold
table stores the following columns:
reponse_generator_model
requires the two tables to be joined to provide it with sufficient input data.
WHERE
clause, like this:
sentiment_classifier_model
requires a parameter named review
, so the data table should contain a column named review
, which is picked up by the model.
Note that, when joining data tables, you must provide the ON
clause condition, which is implemented implicitly when joining the AI tables.
WHERE
clause, like this:
sentiment_classifier_model
takes input data from the amazon_review
table, while the response_generator_model
takes input data from the amazon_reviews
table and from the WHERE
clause.
Furthermore, you can make use of subqueries to provide input data to the models via the WHERE
clause, like this:
income_table
table that stores the income
and debt
values.
income_table
table is as follows:
debt
value for a particular income
value results in the following:
income
value that is not
present there?
WHERE
clause condition is not fulfilled for any of the rows, no value is returned.
debt_model
model that allows us to approximate the debt
value for any income
value. We train the debt_model
model using the data from the income_table
table.
CREATE MODEL
statement. On execution of this statement, the predictive model works in the background, automatically creating a vector representation of the data that can be visualized as follows:
debt
value of some random income
value. To get the approximated debt
value, we query the mindsdb.debt_model
model instead of the income_table
table.