Analysis #2

sample_business_data.csv · 500 rows × 11 columns

Find which factors most strongly influence sales.

regression target: PurchaseAmount metric: R2 6 models evaluated reasoning: built-in analyst

Objective partially fulfilled

The objective was partially met. The model explains only 4.6% of the variation, which is too little to be useful. Success criterion: A model that clearly beats the naive baseline on F1 and behaves sensibly on the outcome the objective cares about.

  • Predictive quality
    The model explains only 4.6% of the variation, which is too little to be useful.
  • Beats the naive baseline
    The trivial baseline scores -0.0010 and the chosen model scores 0.0462 - an improvement of 0.0472.
  • Stable across folds
    5-fold cross-validation gives -4.7451 (± 9.3694) against a test score of 0.0462, so the result is consistent.
Best model
Ridge Regression
of 6 that trained
R2
0.0462
baseline -0.001
Data quality
93/100
before cleaning
Features used
19
18 engineered, 4 removed

Dataset overview

Rows500
Columns11
Numeric columns3
Categorical columns5
Date columns3
Duplicate rows0
Missing cells398 (7.24%)
Size in memory0.23 MB
Distribution of the target variable

Columns the agent found

first 25 shown
ColumnDetected asTypeMissing UniqueExamples
CustomerID numeric int64 0.0% 500 1, 2, 3
Name categorical object 4.0% 477 Mark Cruz, Mr. Christopher Maldonado DDS, Robert Black
DateOfBirth datetime object 6.0% 465 09-13-1979, 04-27-2004, 06-22-1973
SignupDate datetime object 0.0% 272 2020-05-04, 2020-08-21, 2020-10-09
LastPurchaseDate datetime object 0.0% 277 2021-03-22, 2021-07-09, 2021-06-09
PurchaseAmount numeric float64 10.0% 449 495.03, 734.67, 662.94
Currency categorical object 0.0% 3 GBP, USD, EUR
LoyaltyPoints numeric float64 6.0% 364 501.0, 958.0, 144.0
Region categorical object 26.2% 8 West, South, East
Email categorical object 12.0% 433 m.christopher@gmail.com, r.black@gmail.com, d.burnett@yahoo.com
SubscriptionType categorical object 15.4% 3 Standard, Basic, Premium

Data quality

score 93/100
  • medium 7.24% of all cells are missing (398 cells).
  • low 1 identifier-like column(s) detected and excluded from modelling: Name.
  • medium High-cardinality categorical column(s) that will be grouped before encoding: Email.
Missing values by column

Cleaning summary

3 action(s) taken

Before cleaning

Rows500
Columns11
Missing cells398
Duplicates0

After cleaning

Rows500
Columns10
Missing cells378
Duplicates0

What was done

  • Unified category casing. Merged case-variant categories (for example 'Male' and 'male') in 1 column(s).
  • Parsed date columns. Converted 3 text column(s) into real datetime columns so that calendar features can be derived from them.
  • Dropped identifier columns. Looks like a row identifier. Identifiers are unique per row and would let a model memorise rows instead of learning a pattern.
Remaining missing values are imputed inside the modelling pipeline (numeric columns with the median, categorical columns with the most frequent value). The imputers are fitted on the training split only, so no information from the test set leaks into training.

Problem framing and features

split before engineering, so nothing leaks
Problem type and target
Problem typeregression
Target columnPurchaseAmount
Confidence100%
MetricR2
Training rows360
Test rows90

The target is continuous with 449 distinct numeric values.

R² reports the share of variation in the target the model explains, which is comparable across datasets in a way that RMSE is not.

Random 80/20 split with random_state=42.

Features kept
CustomerIDCurrencyLoyaltyPointsRegionEmailSubscriptionTypeDateOfBirth_yearDateOfBirth_dayDateOfBirth_weekdayDateOfBirth_quarterSignupDate_daySignupDate_weekdaySignupDate_quarterLastPurchaseDate_yearLastPurchaseDate_dayLastPurchaseDate_weekdayLastPurchaseDate_quarterLoyaltyPoints_per_CustomerIDLoyaltyPoints_minus_CustomerID

Strongest signal against the target

Currency1.0
SignupDate_quarter0.7988
LoyaltyPoints_minus_CustomerID0.752
DateOfBirth_year0.4432
DateOfBirth_day0.3577
SubscriptionType0.3253

Engineered features

18
FeatureTypeWhy
DateOfBirth_yeardatetime part A model cannot read a raw timestamp, so DateOfBirth was split into its calendar parts, which let it learn seasonal and trend patterns.
DateOfBirth_monthdatetime part Calendar 'month' taken from DateOfBirth.
DateOfBirth_daydatetime part Calendar 'day' taken from DateOfBirth.
DateOfBirth_weekdaydatetime part Calendar 'weekday' taken from DateOfBirth.
DateOfBirth_quarterdatetime part Calendar 'quarter' taken from DateOfBirth.
SignupDate_yeardatetime part A model cannot read a raw timestamp, so SignupDate was split into its calendar parts, which let it learn seasonal and trend patterns.
SignupDate_monthdatetime part Calendar 'month' taken from SignupDate.
SignupDate_daydatetime part Calendar 'day' taken from SignupDate.
SignupDate_weekdaydatetime part Calendar 'weekday' taken from SignupDate.
SignupDate_quarterdatetime part Calendar 'quarter' taken from SignupDate.
LastPurchaseDate_yeardatetime part A model cannot read a raw timestamp, so LastPurchaseDate was split into its calendar parts, which let it learn seasonal and trend patterns.
LastPurchaseDate_monthdatetime part Calendar 'month' taken from LastPurchaseDate.
LastPurchaseDate_daydatetime part Calendar 'day' taken from LastPurchaseDate.
LastPurchaseDate_weekdaydatetime part Calendar 'weekday' taken from LastPurchaseDate.
LastPurchaseDate_quarterdatetime part Calendar 'quarter' taken from LastPurchaseDate.
LoyaltyPoints_per_CustomerIDratio Ratio of two of the most informative numeric columns. Ratios capture relative size, which raw values on their own cannot.
LoyaltyPoints_minus_CustomerIDdifference Gap between LoyaltyPoints and CustomerID; differences often matter more than either value alone.
Email (grouped)rare category grouping 314 rare category value(s) in Email were merged into 'Other'. Encoding each of them would create many near-empty columns that only add noise.

Removed features

4
FeatureReason
SignupDate_yearOnly one distinct value, so it cannot explain any variation.
DateOfBirth_monthCorrelated 0.969 with DateOfBirth_quarter, which carries the same information and scores higher against the target.
SignupDate_monthCorrelated 0.973 with SignupDate_quarter, which carries the same information and scores higher against the target.
LastPurchaseDate_monthCorrelated 0.974 with LastPurchaseDate_quarter, which carries the same information and scores higher against the target.

Models trained and compared

ranked on R2, not on accuracy by default
Model comparison
How the shortlist was chosen

The AI layer suggested model names; the agent resolved each one against a fixed library of hand-written models and refused anything that did not fit.

Linear RegressionRidge RegressionDecision Tree RegressorRandom Forest RegressorGradient Boosting RegressorBaseline (Mean Prediction)

Suggestions the agent refused

  • Logistic Regression — It is a classification model, but this is a regression problem.
  • Decision Tree Classifier — It is a classification model, but this is a regression problem.
  • Random Forest Classifier — It is a classification model, but this is a regression problem.
  • Extra Trees Classifier — It is a classification model, but this is a regression problem.
  • K-Nearest Neighbors Classifier — It is a classification model, but this is a regression problem.
ModelRMSEMAE MSETime (s)
Linear Regression 0.0432 351.07 299.85 123248.0 0.058
Ridge Regression best 0.0462 350.52 299.59 122866.2 0.027
Decision Tree Regressor -0.4313 429.39 348.23 184377.1 0.025
Random Forest Regressor 0.0271 354.01 294.31 125323.6 0.75
Gradient Boosting Regressor -0.0517 368.06 310.64 135471.4 0.198
Baseline (Mean Prediction) baseline -0.0010 359.09 311.17 128946.0 0.021

The selected model

Ridge Regression

R2 0.0462

Ridge Regression achieved the best R2 of 0.0462, ahead of Linear Regression (0.0432) by 0.0030. R2 was chosen because it matches what the objective is asking for.

Linear regression with a penalty that keeps correlated features stable.

Mae 299.5889
Mse 122866.2138
Rmse 350.5228
R2 0.0462
Naive baseline -0.0010
5-fold cross-validation -4.7451 ± 9.3694
Predicted against actual values

What drives the predictions

Absolute model coefficients
Feature importance

The size of each feature's coefficient after scaling. Larger means a one-unit change in that feature moves the prediction more.

#FeatureShare
1Currency_GBP 13.33%
2LoyaltyPoints_minus_CustomerID 11.8%
3SubscriptionType_Standard 9.98%
4SubscriptionType_Premium 9.42%
5Currency_USD 8.99%
6LoyaltyPoints 7.73%
7Currency_EUR 4.34%
8CustomerID 3.5%
9Email_nan 3.43%
10Email_Other 3.43%

Insights and next steps

Key insights
  • Cleaning removed 0 row(s) and 1 column(s) that could not contribute to a reliable model.
  • The winning model's decisions are driven mainly by Currency_GBP (13%), LoyaltyPoints_minus_CustomerID (12%), SubscriptionType_Standard (10%).
  • On average the prediction is off by 299.59 in the target's own units, which is the number to quote when someone asks how accurate it is.
  • The objective was partially met. The model explains only 4.6% of the variation, which is too little to be useful. Success criterion: A model that clearly beats the naive baseline on F1 and behaves sensibly on the outcome the objective cares about.
Recommended next steps
  1. Collect more data. 500 rows is a small sample, and the score above could move considerably on a larger one.
  2. Look for missing explanatory variables. When R² is low, the cause is usually that the drivers of the target were never recorded, not that the model is wrong.
  3. Tune Ridge Regression with a grid or randomised search. This run used sensible defaults with no hyperparameter search, so there is headroom left.
  4. Review the 4 removed feature(s) with a domain expert. Automated selection is statistical; it does not know which columns matter to the business.
  5. Before deploying, re-test on data from a later time period than the training data. A random split cannot tell you whether the pattern holds next quarter.
The built-in analyst's reasoning

'SubscriptionType' scored highest as a target candidate because last column in the file; 3 distinct classes. The objective wording suggests a classification task. Identifier and constant columns were excluded because they cannot generalise. This recommendation was produced by the built-in rule-based analyst rather than Gemini.

Success criterion it set: A model that clearly beats the naive baseline on F1 and behaves sensibly on the outcome the objective cares about.

Caveats from this run
  • Gemini was not used for this run: Gemini call failed: ClientError: 404 NOT_FOUND. {'error': {'code': 404, 'message': 'This model models/gemini-2.0-flash is no longer available. Please update your code to use models/gemini-3.6-flash for the latest features and improvements. We recommend you to use the Interactions API.', 'status': 'N
  • The AI layer suggested classification, but 'PurchaseAmount' is the target is continuous with 449 distinct numeric values. The agent trusted the data and treated this as regression.
  • 50 row(s) had no value for 'PurchaseAmount' and were removed. A missing label cannot be imputed without inventing the answer.
Correlation between numeric columns

The written report goes further than this dashboard

Executive summary, every decision explained, the full metric tables, limitations and recommended next steps — written for technical and non-technical readers at once.

Open the full report