# 067. Page value information audit

**Question:** How does PageValues alter retrospective purchase classification?

## Result

The largest computed metric is 0.7461 for Includes PageValues / Random forest; the smallest is 0.1495 for Without PageValues / Prior baseline. Metric: average_precision (Average precision).

The extra-information variant is a leakage investigation, not a recommended feature set.

![Page value information audit](outputs/chart.png)

| model | accuracy | balanced_accuracy | macro_f1 | roc_auc | average_precision | brier | information | variant |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Prior baseline | 0.8505 | 0.5 | 0.4596 | 0.5 | 0.1495 | 0.1272 | Without PageValues | Without PageValues / Prior baseline |
| Logistic regression | 0.8493 | 0.5038 | 0.4698 | 0.7342 | 0.2881 | 0.1171 | Without PageValues | Without PageValues / Logistic regression |
| Random forest | 0.8505 | 0.5225 | 0.5084 | 0.7748 | 0.3645 | 0.1109 | Without PageValues | Without PageValues / Random forest |
| Prior baseline | 0.8505 | 0.5 | 0.4596 | 0.5 | 0.1495 | 0.1272 | Includes PageValues | Includes PageValues / Prior baseline |
| Logistic regression | 0.8868 | 0.6875 | 0.7258 | 0.8974 | 0.6348 | 0.08288 | Includes PageValues | Includes PageValues / Logistic regression |
| Random forest | 0.9059 | 0.7695 | 0.796 | 0.9287 | 0.7461 | 0.06842 | Includes PageValues | Includes PageValues / Random forest |

The chart shows 6 of 6 result rows; the table previews the first 6 in the analysis-defined order. [Download the full result table](outputs/results.csv). Numerical values are computed from the source; missing results stay unavailable.

## Method

Paired diagnostic models with grouping held fixed to the base features.

The study uses shared source preparation and reusable statistical routines. Its specific transformations are in [analysis.py](analysis.py), and common model/evaluation code is in [portfolio/methods.py](../../portfolio/methods.py). The [notebook](analysis.ipynb) executes the study and displays the saved results.

## Evaluation

Fixed 80/20 split of unique input groups (seed 42); exact input duplicates stay together. Training observations: 9,875; test observations: 2,455. Fixed models; default decision threshold; no holdout tuning.

Target: `revenue`. Features: administrative, administrative_duration, informational, informational_duration, productrelated, productrelated_duration, bouncerates, exitrates, specialday, month, operatingsystems, browser, region, traffictype, visitortype, weekend. Model results and row membership are recorded in [evaluation.json](outputs/evaluation.json).

## Decision and limitations

Exclude downstream outcome information from any deployable conversion model.

One observation is a completed session. End-of-session behavior cannot support an early-session prediction claim. PageValues is excluded from purchase models because it can encode downstream purchase information. Associations are not experiment results. 

Related studies may share observations or holdouts. These are focused analytical studies, not independent replications or deployed business systems. Any model refinements informed by these results need new untouched evaluation data. No commercial impact is inferred from an association or backtest.

## Reproduce

From the repository root, after installing `requirements.txt`:

```powershell
python projects/067-page-value-information-audit/analysis.py
```

Source data are downloaded automatically if absent. Original archives are retained unchanged and checked by SHA-256. The cleaned cache normalizes column names; field-specific changes are visible in [data preparation](../../portfolio/data.py). Runtime evidence is in [receipt.json](outputs/receipt.json).

## Source

[Online Shoppers Purchasing Intention](https://archive.ics.uci.edu/dataset/468/online+shoppers+purchasing+intention+dataset), Sakar and Kastro (2018). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/shoppers.json) and [prepared-data audit](../../data/provenance/shoppers_prepared.json) record the downloaded files, field coverage and hashes.
