Skip to main content
All CollectionsEvaluating a Model
Exploring Predictions with SQL Queries
Exploring Predictions with SQL Queries

Query your data to uncover trends over time, monitor prediction volumes, and discover insights by country or campaign.

Ori Sagi avatar
Written by Ori Sagi
Updated over a week ago

The Analyze page empowers you to explore and understand your model’s predictions freely. Start experimenting with queries and visualizations to uncover valuable insights!

Overview of the predictions schema

The predictions schema contains the results of your model. It includes key columns such as entity columns, sampled_date, and prediction. You can query this schema alongside all the tables you have uploaded to enrich the analysis with additional data sources.

The Analyze page is designed for free exploration of the predictions. You can write SQL queries to uncover trends, distributions, and insights from your model’s predictions. Below are some useful query examples that can help visualize key insight:


Trend of Predictions Over Time

Use Case

Monitoring customer churn over time can help businesses understand seasonal trends and external factors affecting retention. By tracking the average churn probability across different periods, companies can proactively adjust customer engagement strategies.

Graph Type

Line Chart (X-axis: sampled_date, Y-axis: AVG(prediction)) (X-axis: sampled_date, Y-axis: AVG(prediction))

SELECT
DATE(sampled_date) AS date,
AVG(prediction) AS avg_prediction
FROM predictions
GROUP BY date
ORDER BY date;

How Many Predictions Were Made Per Day?

Use Case

Understanding the volume of churn predictions generated daily helps businesses detect unusual spikes or drops in churn likelihood. These fluctuations might indicate external factors affecting customer behavior, such as promotions or competitor activity.

Graph Type

Bar Chart / Line Chart (X-axis: sampled_date, Y-axis: COUNT(*)) / Line Chart (X-axis: sampled_date, Y-axis: COUNT(*))


Aggregating Predictions by Country

Use Case

For a global business, identifying countries with the highest churn risk helps prioritize retention strategies where they are needed most. Aggregating predictions by country reveals where customer churn probability is highest, allowing targeted intervention.

Graph Type

Bar Chart (X-axis: country, Y-axis: SUM(prediction)) (X-axis: country, Y-axis: SUM(prediction))

SELECT
country,
SUM(prediction) AS total_predictions
FROM predictions
GROUP BY country
ORDER BY total_predictions DESC;

This allows you to compare total predictions across different countries and identify where the most activity occurs.


Aggregating Predictions by Campaign

Use Case

In a Customer Lifetime Value (LTV) model, marketers need to assess which campaigns drive the highest predicted revenue. Aggregating predictions at the campaign level helps identify the most effective marketing efforts and optimize future ad spend.

Graph Type

Bar Chart (X-axis: campaign_id, Y-axis: SUM(prediction))

SELECT
campaign_id,
SUM(prediction) AS total_predicted_value
FROM predictions
GROUP BY campaign_id
ORDER BY total_predicted_value DESC;

This can help measure the predicted revenue impact of different campaigns, optimizing marketing budget allocation.


By leveraging these queries, you can gain a deeper understanding of how your model’s predictions behave over time, across different entities, and within specific segments. Whether you're tracking trends, identifying anomalies, or aggregating results, SQL allows for flexible and powerful exploration of your data.

Did this answer your question?