# 089. Compact inspection feature set

**Question:** How much recognition performance changes when only compact geometric features are retained?

## Result

The largest computed metric is 0.7829 for Full / Random forest; the smallest is 0.07239 for Compact / Prior baseline. Metric: macro_f1 (Macro F1).

Feature sets were specified before scoring. The full-signature grouping does not guarantee unseen machine or batch generalization.

![Compact inspection feature set](outputs/chart.png)

| model | accuracy | balanced_accuracy | macro_f1 | features | variant |
| --- | --- | --- | --- | --- | --- |
| Prior baseline | 0.3393 | 0.1429 | 0.07239 | Compact | Compact / Prior baseline |
| Logistic regression | 0.5424 | 0.3337 | 0.3301 | Compact | Compact / Logistic regression |
| Random forest | 0.5887 | 0.5639 | 0.5711 | Compact | Compact / Random forest |
| Prior baseline | 0.3393 | 0.1429 | 0.07239 | Full | Full / Prior baseline |
| Logistic regression | 0.6787 | 0.6901 | 0.6842 | Full | Full / Logistic regression |
| Random forest | 0.7455 | 0.7663 | 0.7829 | Full | Full / 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 fixed-model ablation using the same full-signature input groups.

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: 1,552; test observations: 389. Fixed models; default decision threshold; no holdout tuning.

Target: `fault`. Features: pixels_areas, x_perimeter, y_perimeter, minimum_of_luminosity, maximum_of_luminosity, length_of_conveyer, typeofsteel_a300, typeofsteel_a400, steel_plate_thickness, edges_index, empty_index, square_index, outside_x_index, edges_x_index, edges_y_index, outside_global_index, logofareas, log_x_index, log_y_index, orientation_index, luminosity_index, sigmoidofareas. Model results and row membership are recorded in [evaluation.json](outputs/evaluation.json).

## Decision and limitations

Compare measurement cost and external validation results before reducing the inspection feature set.

Every source row is a recorded fault. The data cannot estimate a production defect rate or distinguish healthy plates. Batch and machine IDs are absent, so grouped exact-input holdouts do not prove factory transfer. 

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/089-compact-inspection-feature-set/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

[Steel Plates Faults](https://archive.ics.uci.edu/dataset/198/steel+plates+faults), Buscema, Terzi and Tastle (2010). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/steel.json) and [prepared-data audit](../../data/provenance/steel_prepared.json) record the downloaded files, field coverage and hashes.
