Sub topic 2
CRM: scoring leads and opportunities
This chapter assumes you know what a contact record, a deal (opportunity), and a pipeline stage are. You should also have seen logistic regression before. It covers five CRM and analytics features.
Lead and opportunity scoring
A lead score is a predicted probability that a contact becomes a customer. The CRM trains a classifier on past leads whose outcome is known, then scores new leads with it. Logistic regression is a common choice because it outputs a probability between 0 and 1.
import numpy as np
from sklearn.linear_model import LogisticRegression
# Columns: requested_demo, free_email_domain, pricing_page_views
X = np.array([
[1, 0, 3],
[0, 1, 0],
[1, 1, 5],
[0, 0, 1],
[1, 0, 4],
[0, 1, 0],
])
# 1 = became a customer, 0 = did not
y = np.array([1, 0, 1, 0, 1, 0])
model = LogisticRegression().fit(X, y)
new_lead = np.array([[1, 0, 2]])
score = model.predict_proba(new_lead)[0, 1]
print(f"Conversion probability: {score:.2f}")Automatic data capture and call summaries
Activity capture logs emails and meetings to a contact record without manual entry. Deduplication merges records that describe the same person. Enrichment adds fields such as company size. Call summaries are written by a language model from a transcript. Check each summary against the transcript before it changes a record.
Forecasts and next-best-action suggestions
A forecast estimates revenue from open deals, usually by weighting each deal by its stage and score. A next-best-action suggestion ranks the next step for a deal, such as a follow-up call. Both are predictions, so treat them as estimates.
Spotting unusual metric changes
Anomaly detection compares the newest value of a metric with its recent history. A z-score measures how many standard deviations a value sits from the mean. A large z-score triggers an alert. The alert shows that a value is unusual, not why.
Asking questions in plain language
A natural-language query feature translates a question such as "Which campaigns grew revenue last month?" into a database query, runs it, and returns the result. Check the generated query, because a wrong filter gives a confident wrong answer.
Exercise
A lead scores 0.91, but the contact uses a free email domain and never requested a demo. Should the system start automatic outreach? Explain.
Show answer
No, not without review. The score is an estimate learned from past data, and the record may be incomplete or biased. The missing demo request and the free email domain contradict the score, so a person should check the lead first.