How to Persist Predictions
MindsDB provides a range of options for persisting predictions and forecasts. Let’s explore all possibilities to save the prediction results.
Reasons to Save Predictions
Every time you want to get predictions, you need to query the model, usually joined with an input data table, like this:
However, querying the model returns the result set that is not persistent by default. For future use, it is recommended to persist the result set instead of querying the model again with the same data.
MindsDB enables you to save predictions into a view or a table or download as a CSV file.
Creating a View
After creating the model, you can save the prediction results into a view.
Now the review_sentiment
view stores sentiment predictions made for all customer reviews.
Here is a comprehensive tutorial on how to predict sentiment of customer reviews using OpenAI.
Creating a Table
After creating the model, you can save predictions into a database table.
Here, the local_postgres
database is a PostgreSQL database connected to MindsDB with a user that has the write access.
Now the question_answers
table stores all prediction results.
Here is a comprehensive tutorial on how to answer questions using OpenAI.
Downloading a CSV File
After executing the SELECT
statement, you can download the output as a CSV file.
Click the Export
button and choose the CSV
option.