Part III: Discovery Through Data & Models
Chapter 25: Exploratory Discovery

Exploratory Discovery

"I plotted 47 histograms before breakfast. Three of them screamed. The rest just whispered politely about their distributions."

A Scatter Plot With Opinions

Overview

Exploratory data analysis (EDA) is not a preliminary chore you endure before the "real" modeling begins. It is the first genuine act of scientific inquiry on a new dataset: the moment you discover which questions are even worth asking. In this chapter, we treat EDA as a structured discovery process, moving from raw observation through pattern recognition to hypothesis generation, with modern computational tools doing the heavy lifting at every stage.

We begin by reframing EDA as inquiry rather than visualization (Section 25.1), establishing the intellectual framework and the toolchain (pandas, Polars, DuckDB) that supports it. Section 25.2 introduces the mathematical core: clustering algorithms (k-means, HDBSCAN, Gaussian mixture models) and dimensionality reduction (PCA, UMAP), showing how they partition high-dimensional data into interpretable groups and projections. Section 25.3 tackles the transition from exploration to hypothesis: cluster stability assessment (silhouette scores, DBCV), enrichment analysis, and the use of large language models to generate scientific hypotheses from discovered patterns. Finally, Section 25.4 assembles these components into a complete exploration notebook that clusters real data, projects it with UMAP, and hands the results to an LLM for automated hypothesis generation.

Prerequisites

This chapter assumes you have read Chapter 1 (Discovery as Search), where we framed discovery as navigating a state space, and Chapter 5 (Discovery Through Data, Models, and Simulation), where we introduced data-driven and theory-driven paradigms. Familiarity with Chapter 2 (Scientific Discovery) and the hypothesis-experiment cycle will also help. You should be comfortable with Python, NumPy, and basic statistics (means, variances, distributions). Prior exposure to scikit-learn is useful but not required; we introduce every algorithm from first principles.

What You Will Learn

Sections

What's Next

Exploratory discovery reveals structure in raw data, but the representations we used (raw features, cluster labels, 2D projections) are shallow. Chapter 26: Representation Learning shows how neural networks learn rich, task-aware embeddings that capture deeper regularities. The UMAP projections and cluster analyses from this chapter become diagnostic tools for understanding learned representations, closing the loop between exploration and modeling.

Bibliography

Foundational Papers

McInnes, L., Healy, J., & Melville, J. (2018). "UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction." arXiv:1802.03426.

The original UMAP paper, introducing a topological approach to dimensionality reduction that preserves both local and global structure better than t-SNE.

Campello, R. J. G. B., Moulavi, D., & Sander, J. (2013). "Density-Based Clustering Based on Hierarchical Density Estimates." PAKDD.

The HDBSCAN paper, which extends DBSCAN to handle clusters of varying density through a hierarchical approach.

Books

Tukey, J. W. (1977). Exploratory Data Analysis. Addison-Wesley.

The book that coined the term EDA. Tukey's philosophy of letting data speak before imposing models remains the foundation of modern exploratory work.

Aggarwal, C. C. & Reddy, C. K. (2013). Data Clustering: Algorithms and Applications. CRC Press.

A comprehensive reference on clustering algorithms, from partitional and hierarchical methods to density-based and spectral approaches.

Tools & Libraries

McInnes, L. (2018). UMAP: Uniform Manifold Approximation and Projection. Python library.

The reference UMAP implementation, supporting supervised, semi-supervised, and parametric variants with GPU acceleration via cuML.

McInnes, L. & Healy, J. (2017). HDBSCAN: Hierarchical Density-Based Spatial Clustering. Python library.

Production HDBSCAN implementation with soft clustering, outlier detection, and integration with scikit-learn's API.

Vink, R. (2021). Polars: Blazingly fast DataFrames in Rust and Python.

A modern DataFrame library that outperforms pandas on medium-to-large datasets through lazy evaluation and columnar memory layout.

Raasveldt, M. & Mühleisen, H. (2019). DuckDB: An Embeddable Analytical Database.

An in-process SQL database that queries CSV, Parquet, and DataFrame objects directly, ideal for analytical EDA on datasets too large for pandas.

Plotly Technologies (2015). Plotly Python Open Source Graphing Library.

Interactive visualization library producing zoomable, hoverable charts ideal for exploratory analysis of clusters and projections.

Tutorials & Surveys

Borisov, V. et al. (2022). "Deep Neural Networks and Tabular Data: A Survey." IEEE TNNLS.

A survey of deep learning methods for tabular data, contextualizing when neural embeddings outperform classical EDA features.

Pedregosa, F. et al. (2011). scikit-learn Clustering module documentation.

Practical guide to clustering in scikit-learn, with algorithm comparison charts and guidance on choosing the right method.

Coenen, A. & Pearce, A. (2019). "Understanding UMAP." Google PAIR.

An interactive visual explainer of UMAP's hyperparameters and their effects on projection quality.