mirror of
https://github.com/hanzoai/papers.git
synced 2026-10-29 07:34:31 +00:00
86 lines
2.8 KiB
TeX
86 lines
2.8 KiB
TeX
\section{Feature Engineering}
|
|
|
|
|
|
\subsection{Feature Categories}
|
|
|
|
We extract 847 features organized into categories:
|
|
|
|
\begin{table}[h]
|
|
\centering
|
|
\caption{Feature Categories}
|
|
\begin{tabular}{lcp{6cm}}
|
|
\toprule
|
|
\textbf{Category} & \textbf{Count} & \textbf{Description} \\
|
|
\midrule
|
|
Recency & 42 & Time since last action by type \\
|
|
Frequency & 89 & Action counts over time windows \\
|
|
Monetary & 67 & Purchase amounts and patterns \\
|
|
Engagement & 156 & Session depth, page views, dwell time \\
|
|
Product Affinity & 234 & Category preferences, brand loyalty \\
|
|
Temporal & 78 & Day/time patterns, seasonality \\
|
|
Device/Channel & 45 & Platform usage, referral sources \\
|
|
Social & 34 & Reviews, shares, referrals \\
|
|
Lifecycle & 102 & Customer age, milestone events \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\end{table}
|
|
|
|
\subsection{Recency-Frequency-Monetary (RFM) Features}
|
|
|
|
Classical RFM features are computed over multiple time windows:
|
|
|
|
\begin{definition}[Windowed RFM]
|
|
For customer $c$ and time window $w$:
|
|
\begin{align}
|
|
R_w(c) &= t_{now} - \max\{t : (t, c, PURCHASE, \cdot, \cdot) \in \mathcal{E}, t \in w\} \\
|
|
F_w(c) &= |\{e \in \mathcal{E} : e.c = c \land e.a = PURCHASE \land e.t \in w\}| \\
|
|
M_w(c) &= \sum_{\substack{e \in \mathcal{E} \\ e.c = c, e.a = PURCHASE, e.t \in w}} e.amount
|
|
\end{align}
|
|
\end{definition}
|
|
|
|
Time windows: $w \in \{7d, 30d, 90d, 365d, lifetime\}$
|
|
|
|
\subsection{Engagement Features}
|
|
|
|
\begin{definition}[Session Engagement Score]
|
|
For session $s$ with events $\mathcal{E}_s$:
|
|
\begin{equation}
|
|
engagement(s) = \alpha \cdot pages(s) + \beta \cdot duration(s) + \gamma \cdot depth(s)
|
|
\end{equation}
|
|
where:
|
|
\begin{itemize}
|
|
\item $pages(s)$: unique pages viewed
|
|
\item $duration(s)$: session length in seconds
|
|
\item $depth(s)$: maximum funnel stage reached
|
|
\end{itemize}
|
|
\end{definition}
|
|
|
|
\subsection{Product Affinity Features}
|
|
|
|
We compute category and brand affinity scores:
|
|
|
|
\begin{equation}
|
|
affinity(c, category) = \frac{\sum_{p \in category} interactions(c, p)}{\sum_{p \in \mathcal{P}} interactions(c, p)}
|
|
\end{equation}
|
|
|
|
\begin{algorithm}
|
|
\caption{Real-Time Feature Computation}
|
|
\begin{algorithmic}[1]
|
|
\Function{UpdateFeatures}{$event$, $features$}
|
|
\State $c \gets event.customer$
|
|
\State $features[c].last\_seen \gets event.t$
|
|
\If{$event.action = PURCHASE$}
|
|
\State $features[c].purchase\_count \gets features[c].purchase\_count + 1$
|
|
\State $features[c].total\_spend \gets features[c].total\_spend + event.amount$
|
|
\State $features[c].last\_purchase \gets event.t$
|
|
\ElsIf{$event.action = VIEW$}
|
|
\State $features[c].view\_count \gets features[c].view\_count + 1$
|
|
\State \Call{UpdateAffinity}{$c$, $event.product.category$}
|
|
\EndIf
|
|
\State \Call{UpdateWindowed}{$features[c]$, $event$}
|
|
\State \Return $features[c]$
|
|
\EndFunction
|
|
\end{algorithmic}
|
|
\end{algorithm}
|
|
|