Skip to content

Insights and the Limits of Analysis ​

This page covers the format for turning analysis results into strategy, the code structure, and the limits of the A1-1 analysis.

Evidence, Action, Validation ​

Each insight is written in three parts.

PartWhat goes inA1-1 example
EvidenceNumbers or chartsThe 21.7% who are VIPs account for 68.0% of the purchase amount
ActionTarget segment, how to act, expected effectStrengthen VIP membership benefits before the peak season
ValidationAdditional data needed, or ways it could be disprovenCheck whether 68% holds even after removing a few very large customers

Ways it could be disproven means writing down in advance the cases where this conclusion could be wrong. It keeps you from jumping to a conclusion based on a single number.

Pipeline Class ​

A pipeline is a flow that passes data through a fixed order, such as load → clean → features → analyze. Instead of scattering code across notebook cells, bundling the steps into methods of a class lets you reuse them on other data. If the outlier threshold (1.5) or imputation method (mode, median, mean) are taken as arguments, it is also easy to experiment by changing the values.

python
a = DataAnalyzer()
a.load_data()
a.handle_missing_values(target_col="description", group_col="stock_code", strategy="mode")
a.clean_data()
outliers = a.detect_outliers("quantity", threshold=1.5)
rfm = a.calculate_rfm()

Limits of the A1-1 Analysis ​

  • The images are not real product photos. The transaction data has no images, so clothing images were attached to products with random numbers (seed 42). They were for NumPy practice and were not used in the insights.
  • There are only 2 years of data. It is hard to tell whether the pattern of sales concentrating in October and November repeats every year. The last month (2011-12) had only 9 days of data, so it was left out of the monthly trend.
  • Original orders that were later canceled remain. Only the cancellation rows (C) were removed, so a customer who ordered 80,995 items and canceled all of them 12 minutes later had their purchase amount inflated to about 168,470.
  • All exact duplicate rows were removed. This may have also removed valid rows where the same product was entered twice in the same order.
  • Transactions without customer numbers were left out of RFM. If these transactions are concentrated among a certain type of customer, the group proportions could change.
  • The group criteria are rules I set, and the scores are relative. Changing the criteria or using data from a different period changes the number of customers in each group.
  • The mean is pulled by a few customers. The VIP mean purchase amount (9,276) is 2.3 times the median (4,002), so the conclusion that VIPs account for 68% of sales may also be driven by a handful of very large customers.
  • The expected effects are assumptions. Numbers like "if 10% of churned customers come back" are rough estimates, and the actual effect can only be confirmed with experimental data.

Next time, I plan to pair up original orders and their cancellations and remove them together. I also want to separate churned customers from seasonal customers with cohort analysis, and check how much the results shift as the group criteria change.

Interview Questions ​

Q. Why did you build the analysis code as a class instead of writing it directly in the notebook? ​

This checks whether you designed the code to be reusable, not just the analysis results.

Scattering code across notebook cells makes it easy for the execution order to get tangled and hard to reuse on other data. In A1-1, loading, missing value handling, cleaning, outlier detection, and RFM calculation were bundled into methods of a DataAnalyzer class, and the notebook only called the methods. The outlier threshold and missing value imputation method are taken as arguments, so you can compare results by changing values without modifying the code.

Follow-up Questions ​

  • How do you check whether the strategy of sending coupons to churned customers actually worked? → You need an experiment (A/B test) that splits customers into those who received a coupon and those who didn't and compares their repurchase rates.

Source: dubu-alt/A1-1 (Codyssey AI Advanced A1-1 mission)