Files
papers/hanzo-analytics-ml/sections/05-customer-segmentation.tex

78 lines
2.4 KiB
TeX

\section{Customer Segmentation}
\subsection{Behavioral Embeddings}
We learn dense customer representations from behavioral sequences:
\begin{definition}[Behavioral Embedding]
For customer $c$ with event sequence $\mathcal{E}_c = (e_1, e_2, \ldots, e_n)$:
\begin{equation}
\mathbf{z}_c = encoder(\mathcal{E}_c) \in \mathbb{R}^d
\end{equation}
where $d = 64$ is the embedding dimension.
\end{definition}
\subsubsection{Sequence Encoder}
We use a bidirectional LSTM encoder:
\begin{align}
\overrightarrow{\mathbf{h}}_t &= LSTM(\mathbf{e}_t, \overrightarrow{\mathbf{h}}_{t-1}) \\
\overleftarrow{\mathbf{h}}_t &= LSTM(\mathbf{e}_t, \overleftarrow{\mathbf{h}}_{t+1}) \\
\mathbf{z}_c &= [\overrightarrow{\mathbf{h}}_n; \overleftarrow{\mathbf{h}}_1]
\end{align}
\subsection{Segmentation Algorithm}
\begin{algorithm}
\caption{Behavioral Customer Segmentation}
\begin{algorithmic}[1]
\Function{SegmentCustomers}{$\mathcal{C}$, $k$}
\State \Comment{Compute behavioral embeddings}
\For{$c \in \mathcal{C}$}
\State $\mathbf{z}_c \gets$ \Call{ComputeEmbedding}{$\mathcal{E}_c$}
\EndFor
\State \Comment{K-means with cosine distance}
\State $\mathcal{Z} \gets \{\mathbf{z}_c : c \in \mathcal{C}\}$
\State $centroids \gets$ \Call{KMeansPlusPlus}{$\mathcal{Z}$, $k$}
\Repeat
\For{$c \in \mathcal{C}$}
\State $segment(c) \gets \arg\min_i cosine(\mathbf{z}_c, centroids_i)$
\EndFor
\For{$i \in [1, k]$}
\State $centroids_i \gets mean(\{\mathbf{z}_c : segment(c) = i\})$
\EndFor
\Until{converged}
\State \Return $segment$
\EndFunction
\end{algorithmic}
\end{algorithm}
\subsection{Segment Interpretation}
Each segment is characterized by:
\begin{itemize}
\item \textbf{Centroid features}: Average feature values
\item \textbf{Behavioral patterns}: Common action sequences
\item \textbf{Value metrics}: LTV, purchase frequency, engagement
\end{itemize}
\begin{table}[h]
\centering
\caption{Example Segment Profiles}
\begin{tabular}{lcccc}
\toprule
\textbf{Segment} & \textbf{Size} & \textbf{Avg LTV} & \textbf{Purchases/Yr} & \textbf{Churn Risk} \\
\midrule
Power Buyers & 8\% & \$1,247 & 12.3 & Low \\
Regular Shoppers & 24\% & \$342 & 4.1 & Medium \\
Browsers & 31\% & \$89 & 1.2 & High \\
Deal Seekers & 19\% & \$156 & 2.8 & Medium \\
Dormant & 18\% & \$45 & 0.3 & Very High \\
\bottomrule
\end{tabular}
\end{table}