Predict which leads will convert
Your CRM already knows which leads became customers and what they did during the trial. Spavik learns from those past leads and gives each new prospect a probability of buying, so sales can call the right people first.
- Returns
- A probability of converting, per lead
- Language
- Python
In your app
Acme
conversion probability
Display the conversion probability on the prospect’s record.
The data you need
One row per past case. Spavik learns how the inputs relate to the column you want to predict.
Past leads, their interactions with your product and whether they became customers.
| Column | Role | Meaning |
|---|---|---|
visits | Input | Visits during the trial |
trial_days | Input | Days of trial used |
demo_booked | Input | 1 if a demo was booked |
converted | Predicted | 1 for a paying customer, otherwise 0 |
The code
A complete, commented script. Set SPAVIK_API_KEY in your server environment, never in browser code.
from spavik import Spavik
# Set SPAVIK_API_KEY in your server environment.
spavik = Spavik()
# leads.csv: visits, trial_days, demo_booked, converted.
# converted = 1 for a paying customer, otherwise 0.
history = "leads.csv"
report = spavik.evaluate(history, target="converted")
if report["assessment"]["status"] != "better_than_baseline":
raise ValueError(report["assessment"]["message"])
# Create once, then reuse for new prospects.
model = spavik.train(history, target="converted")
# Acme's current activity, before a purchase is known.
prospect = {
"visits": 8,
"trial_days": 5,
"demo_booked": 1,
}
result = model.predict(prospect)
# Use the probability of conversion, not the 0/1 label.
probability = result.lignes[0]["proba_1"]
print(f"Acme conversion probability: {probability:.0%}")
How it works
- 1
Check your data
evaluate()tells you, for free, whether your history does better than a simple guess. - 2
Learn from your history
train()creates the model once, for free. Keep it and reuse it for every new case. - 3
Ask for predictions
predict()returns a value for each new row, from your server. One credit per row. - 4
Keep it accurate
Report what actually happened with
submit_outcomes(), checkperformance(), thenrefresh().
Questions
How much history do I need?
At least 10 rows, with at least 2 different values in the column you predict. Include leads that converted and leads that did not, measured at the same point of the trial. evaluate() tells you for free whether your history does better than a simple guess before you train anything.
What does it cost?
Checking your data with evaluate() and creating the model with train() are free. Each predicted row costs one credit on the default engine. You train once and keep the model, so you pay only for the predictions you request.