# Unsupervised learning, recommendations and anomaly review

Run `python unsupervised_cases.py` from this directory. The lab executes original deterministic cases for NP-0361 through NP-0380 and writes `unsupervised-verification.json`.

The clustering fixture has 360 synthetic customers and three generator-only behaviour types. Fitted clusters never use those labels. Cases cover feature/scaling sensitivity, silhouette distributions, DBSCAN settings, Euclidean versus cosine hierarchy, bootstrap stability, training-only PCA, t-SNE configuration, actionable profile hypotheses and aligned segment drift. UMAP is not installed or executed; no UMAP measurement is reported.

The recommendation fixture contains 60 synthetic users, 20 items and four earlier plus one held-out interaction per user. Item I19 has no training interactions to expose cold start. Content recommendations use authored binary tags and cosine similarity. Collaborative recommendations use a five-component truncated SVD and temporal holdout. Offline metrics do not establish causal value, exposure fairness or production quality.

The anomaly fixture contains 1,000 normal and 20 shifted synthetic points. Isolation Forest fits without labels; generator labels are used only after ranking to assess review budgets. “Anomaly” never means fraud or wrongdoing by definition.

Primary references: [scikit-learn clustering guide](https://scikit-learn.org/stable/modules/clustering.html), [silhouette example](https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html), [t-SNE parameter example](https://scikit-learn.org/stable/auto_examples/manifold/plot_t_sne_perplexity.html), [PCA](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html), [cosine similarity](https://scikit-learn.org/stable/modules/metrics.html#cosine-similarity), [TruncatedSVD](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.TruncatedSVD.html), and [IsolationForest](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.IsolationForest.html).
