Build Training Features and Train Two Models
This section works on the training data. It first calculates two aggregated features: conversion rate by origin and conversion rate by landing page, then joins those summary rates back onto each training row so every record includes both its original values and these group-level performance signals. After that, it fills in missing values, keeps only the columns needed for modeling, converts the target into the right categorical format, and uses SMOTE to balance the classes by creating synthetic examples of the minority class. Finally, it refreshes the data metadata and trains two classification models in parallel: a Random Forest and a Logistic Regression, so their performance can be compared later.