# Learn how to score prospects in real time using Signals and machine learning
> Build a real-time prospect scoring system using Snowplow Signals and machine learning to predict conversion likelihood.
> Source: https://docs.snowplow.io/tutorials/signals-ml-prospect-scoring/intro/
> Documentation index: https://docs.snowplow.io/llms.txt

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/snowplow-incubator/signals-notebooks/blob/main/web/web_prospect_scoring_end_to_end.ipynb)

> **Tip: Build training datasets with the dataset builder**
>
> To build point-in-time correct training data from Signals attributes with the dataset builder, follow [Train and serve a purchase propensity model](/tutorials/signals-ml-purchase-propensity/introduction/).

Welcome to the [Snowplow Signals](/docs/signals/introduction/) real-time prospect scoring tutorial.

Snowplow Signals computes attributes from your behavioral data in real time and serves them to your applications over an API. It works with both in-session stream data and historical warehouse data.

This guide will through the process of building a real-time prospect scoring system using Signals together with a machine learning model. You'll learn how to leverage Snowplow event data to predict a prospect's likelihood to convert on your website, and how to trigger personalized engagements.

Use this tutorial as a starting point for how to integrate Signals data with any ML use cases or other back-end services.

The tutorial uses the Snowplow marketing website as an example. Follow along using your own website and Snowplow data.

At the end of the tutorial, you will:

- See live prospect attribute updates in the browser console
- Score prospects using an ML model
- Be ready to use the outputs to drive decisions on your website

## Business case overview

Prospects on the Snowplow marketing website visit product and pricing pages, watch videos, etc. The key call to action is a form submission to request a demo.

We want to predict if a specific prospect is likely to submit a form in the next hour, given their behavior before the prediction moment.

![Diagram showing the prediction structure: a timeline of 30 days of user behaviour with attributes aggregated over time (num\_pageviews, num\_sessions, latest\_geo), leading to a prediction point that asks whether the prospect will submit\_form in the next 1 hour](/assets/images/prediction-structure-6110e68ef2574e58b5b22a2ad73c2390.png)

For simplicity in this tutorial, we'll score prospects every 10 seconds as they browse the website. Depending on your requirements, you could score prospects at the start of each `page_view`, after certain events, or at some other time interval.

We're calculating aggregated attributes based off real-time stream event data, so won't have much user history to work with initially. Over time, as prospects visit and revisit the website, the attributes will become more meaningful.

## Prerequisites

1. [Enable Signals](/docs/signals/setup/) for your Snowplow account
2. Open the notebook using the **Open in Colab** badge
3. \[Optional] Integrate Snowplow into your website

> **Note: Snowplow account required**
>
> Signals calculates the prospect attributes from events flowing through your Snowplow pipeline. If you don't have one, you can use the [Signals free tier](https://signals.snowplow.io/start?utm_source=docs.snowplow.io\&utm_medium=referral) to follow along.

## Architecture

The system consists of three main blocks:

1. **Your marketing website**: as users browse the website, Snowplow events are sent to the Snowplow Collector
2. **Snowplow Infrastructure**: the Collector captures the events, and Signals calculates aggregated user attributes in real time e.g., `num_page_views`, `num_customers_views`
3. **Intermediary `/predict` API**: an API that calls the Signals API to get the latest attributes, runs an ML model on the Signals output, and sends the response back

![Architecture diagram showing user events flowing from a marketing website to the Snowplow Event Collector and Signals API, then to a prospect scoring API server with a /predict endpoint. The server uses the snowplow-signals-sdk to call get\_online\_attributes(), feeds results through custom logic and an ML model, and returns a likely-to-convert prediction to the website.](/assets/images/solution_overview-268d0581d22caed9db29407d4260f603.png)

> **Note:** You can replace the ML model with any other back-end system that you'd use to act on live prospects' attributes.
