\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb}
\usepackage{algorithm,algpseudocode}
\usepackage{bm}
\usepackage{hyperref}
\usepackage{float}
\usepackage{subcaption}
\usepackage{enumitem}
\usepackage{xcolor}
\definecolor{darkgreen}{rgb}{0.0, 0.5, 0.0}
\definecolor{aaltoBlue}{RGB}{0, 51, 102}
\definecolor{pinegreen}{cmyk}{0.92,0,0.59,0.25}
\definecolor{royalblue}{cmyk}{1,0.50,0,0}
\definecolor{lavander}{cmyk}{0,0.48,0,0}
\definecolor{violet}{cmyk}{0.79,0.88,0,0}
\definecolor{lightblue}{RGB}{173, 216, 230}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc,arrows.meta,positioning,fit,shapes.geometric,shapes.misc,intersections,patterns,decorations.pathreplacing,backgrounds,matrix}
\usepgfplotslibrary{fillbetween,groupplots}
\setcounter{secnumdepth}{-\maxdimen}
% Long unbreakable tokens (the ISO/IEC author names in citations, term names
% in the title) otherwise overflow the margin by a few points; a modest
% emergency stretch lets TeX loosen the paragraph instead.
\emergencystretch=2em
\usepackage{mleftright}
% Project macros used by this entry (auto-extracted).
\newcommand{\iteridx}{t}
\newcommand{\mM}[0]{{\bf M}}
\newcommand{\regparam}{\alpha}
\newcommand{\vb}[0]{{\bf b}}
\newcommand{\vx}[0]{{\bf x}}

\begin{document}

\section{data imputation}

\subsection*{Author and editors}
Alexander Jung\textsuperscript{*}, Department of Computer Science, Aalto University, Espoo, Finland (ORCID \mbox{\href{https://orcid.org/0000-0001-7538-0990}{0000-0001-7538-0990}}) \\
Editors: Konstantina Olioumtsevits (ORCID \mbox{\href{https://orcid.org/0000-0003-2697-8659}{0000-0003-2697-8659}}), Ekkehard Schnoor (ORCID \mbox{\href{https://orcid.org/0000-0001-8252-1499}{0000-0001-8252-1499}}), Aalto University, Espoo, Finland \\
\textsuperscript{*}Corresponding author: \href{mailto:alex.jung@aalto.fi}{alex.jung@aalto.fi}

\subsection{Synonyms}
imputation, missing-value imputation

\subsection{Abstract}
Data imputation replaces missing attribute values of
		data points by estimates computed from the attribute values
		that were recorded. In tabular data a missing value is an
		empty cell of the table, and imputation fills the cell. It is one
		response to missing data, alongside discarding the incomplete
		data points. The filling is a machine learning (ML) problem: the missing
		value is the label of a data point, the recorded values
		beside it are its features, and the complete
		data points form a training set on which a hypothesis
		map (an imputer) is learned.

\subsection{Definition}
The weather station Krems an der
		Donau records, for each day, the minimum temperature, the
		precipitation, and the maximum temperature. The year $2024$ is
		therefore a table with one row per day and one column per quantity
		(GeoSphere Austria, 2026). This table is tabular data. A day on
		which the thermometer failed leaves the maximum-temperature cell of
		its row empty, while the table keeps its shape
		(Fig.~\ref{fig_dataimputation_table_dict}). Data imputation fills
		such a cell: it replaces missing attribute values of
		data points, features or labels, by estimates
		computed from the attribute values that were recorded
		(Little and Rubin, 2019). It is one response to missing data,
		alongside discarding the incomplete data points or using a
		method that tolerates the gaps (Little and Rubin, 2019).
		\begin{figure}[H]
		\begin{center}
		\begin{tikzpicture}[font=\scriptsize]
			% column boundaries: 0 | 1.7 | 3.8 | 5.9 | 7.9
			\fill[gray!15] (1.7,0) rectangle (3.8,2.0);
			\fill[gray!35] (5.9,0) rectangle (7.9,2.0);
			\fill[white] (5.9,0.5) rectangle (7.9,1.5);
			\draw (0,0) rectangle (7.9,2.5);
			\draw (0,2.0) -- (7.9,2.0);
			\foreach \y in {0.5, 1.0, 1.5}
				\draw[black!40] (0,\y) -- (7.9,\y);
			\foreach \x in {1.7, 3.8, 5.9}
				\draw (\x,0) -- (\x,2.5);
			\node at (0.85,2.25) {date};
			\node at (2.75,2.25) {min.\ temp.};
			\node at (4.85,2.25) {precip.};
			\node at (6.9,2.25) {max.\ temp.};
			\foreach \y/\a/\b/\c/\d in {1.75/{Jul 9}/18.1/-1.0/32.5,
					1.25/{Jul 10}/18.8/2.7/{},
					0.75/{Jul 11}/19.4/2.7/{},
					0.25/{Jul 12}/19.4/20.8/32.3} {
				\node at (0.85,\y) {\a};
				\node at (2.75,\y) {$\b$};
				\node at (4.85,\y) {$\c$};
				\node at (6.9,\y) {$\d$};
			}
			\draw[decorate, decoration={brace, raise=3pt}]
				(1.7,2.5) -- (3.8,2.5)
				node[midway, above=6pt] {feature};
			\draw[decorate, decoration={brace, raise=3pt}]
				(5.9,2.5) -- (7.9,2.5)
				node[midway, above=6pt] {label};
			\draw[decorate, decoration={brace, raise=3pt}]
				(-0.1,0) -- (-0.1,2.0)
				node[midway, left=6pt, align=center]
				{one data point\\per row};
			\draw[decorate, decoration={brace, raise=3pt}]
				(8.0,1.5) -- (8.0,0.5)
				node[midway, right=6pt, align=center]
				{empty cells\\to be filled};
		\end{tikzpicture}
		\end{center}
		\caption{Four of the $366$ rows of the table of daily weather
			measurements recorded in $2024$, July 9--12. Each row is a
			data point, namely one day; the headers abbreviate the
			minimum temperature (min.\ temp.), the precipitation (precip.),
			and the maximum temperature (max.\ temp.), and the special value
			$-1.0$ of the precipitation column records that no precipitation
			was observed. The maximum-temperature cells of July 10 and 11 are
			empty. The light gray column holds the feature and the dark
			gray column the label of a day, so the two complete rows
			shown, and the other complete days, supply both, while the
			two empty cells are the labels to be imputed
			\label{fig_dataimputation_table_dict}}
		\end{figure}
		The filling is a machine learning (ML) problem (Abayomi et al., 2008).
		The empty cell is the label of its row, and the recorded
		cells of the same row are its features. The complete rows
		form a training set, since each one supplies both a
		feature vector and the label that belongs with it. A
		hypothesis map, an imputer, is learned from them by
		empirical risk minimization (ERM). Applying that hypothesis to an incomplete row
		yields the estimate that fills its cell. The simplest imputation
		fills every empty cell of a column with the sample mean of
		the recorded cells of that column, which is the hypothesis
		that ignores the feature vector (Little and Rubin, 2019).
\par
		A numerical experiment takes $15$ days spread over the year and
		empties the maximum-temperature cells of $3$ of them. From the $12$ complete rows, it learns a
		linear regression hypothesis that maps the minimum temperature of
		a day to its maximum temperature. The emptied cells are then filled
		with its predictions, shown as a scatterplot in
		Fig.~\ref{fig_dataimputation_scatter_dict}. The removed values are
		known, so the filling can be evaluated. The average squared error loss
		on the $3$ cells, in squared degrees Celsius, is $17.6$ for the
		learned hypothesis and $150.2$ for the column average.
		\begin{figure}[H]
		\begin{center}
		\begin{tikzpicture}
		\begin{axis}[
			width=0.8\linewidth, height=0.38\linewidth,
			axis lines=left, enlargelimits=0.08,
			xlabel={minimum temperature of the day ($^{\circ}$C)},
			ylabel={maximum temperature of the day ($^{\circ}$C)},
			tick label style={font=\small},
			label style={font=\small},
			legend style={draw=none, fill=none, font=\footnotesize,
				at={(0.5,-0.32)}, anchor=north, legend columns=2,
				/tikz/every odd column/.append style={column sep=0.15cm},
				/tikz/every even column/.append style={column sep=0.4cm}},
			legend cell align=left,
			]
			\addplot[only marks, mark=*, mark size=1.6pt, color=black!45]
				table[col sep=comma, x=tmin, y=tmax]{dataimputation_days.csv};
			\addlegendentry{complete days}
			\addplot[very thick]
				table[col sep=comma, x=tmin, y=tmax]{dataimputation_line.csv};
			\addlegendentry{learned hypothesis}
			\addplot[only marks, mark=x, mark size=3pt, thick]
				table[col sep=comma, x=tmin, y=tmax_removed]{dataimputation_cells.csv};
			\addlegendentry{removed value}
			\addplot[only marks, mark=square, mark size=2.2pt, thick]
				table[col sep=comma, x=tmin, y=tmax_filled]{dataimputation_cells.csv};
			\addlegendentry{imputed value}
		\end{axis}
		\end{tikzpicture}
		\end{center}
		\caption{Scatterplot of $15$ days of the table in
			Fig.~\ref{fig_dataimputation_table_dict}, spread over the year,
			with the minimum temperature of a day as its feature and
			the maximum temperature as its label. The $12$ complete
			days are gray circles, and the solid line is the linear regression
			hypothesis learned from them. For each of the $3$ emptied
			cells, a cross marks the removed value and an open square the
			imputed value
			\label{fig_dataimputation_scatter_dict}}
		\end{figure}
		A missing value can sit among other missing values, so that the
		feature vector of its row is itself incomplete. Rectangular
		patches lost from an aerial photograph are such a case. Each pixel
		is a data point, its features are the colors of the
		eight pixels around it, and its label is its own color, so a
		lost pixel inside a patch has lost neighbors as well. The filling
		then proceeds in sweeps: the missing values start at the
		sample mean of the recorded ones, and each sweep re-estimates
		them from the values that their neighbors currently hold, until
		the values no longer change. For a linear model, one sweep maps
		the vector $\vx$ of missing values to $\mM \vx + \vb$, with
		a matrix $\mM$ built from the weights of the
		hypothesis. Two runs started at $\vx$ and $\vx'$ differ
		after $\iteridx$ sweeps by $\mM^{\iteridx} (\vx - \vx')$, so
		the sweeps converge from every start if and only if
		$\mM^{\iteridx} \to \mathbf{0}$, i.e., if and only if the
		spectral radius $\rho(\mM)$ is below one
		(Horn and Johnson, 2013, Thm.~5.6.12), and the limit is then the
		unique fixed point of the sweep. A numerical experiment
		fills the lost pixels by such sweeps. For the hypothesis
		learned from the intact pixels by least squares, $\rho(\mM) =
		2.72$ and the sweeps diverge. The penalty term of
		ridge regression shrinks the weights: with the
		regularization parameter $\regparam = 0.03$, the
		hypothesis learned
		by ridge regression gives $\rho(\mM) = 0.84$, and the sweeps
		converge. With that hypothesis, the average squared error loss
		on the lost pixels is half that of the baseline that fills
		every one of them with the average color, and the boundaries
		where the colors change sharply come out blurred.
\par
		An imputed value is an estimate and not a measurement, and a method
		trained on imputed data points cannot tell the two apart.
		Part of the training set was produced by a hypothesis
		rather than observed, so a training error that averages over
		imputed cells scores a hypothesis partly against the
		predictions of the imputer rather than against
		measurements; for the imputer itself, every filled cell
		contributes zero loss. A single filled value also
		carries no information about the uncertainty of the estimate
		(Hastie et al., 2009, Sect.~9.6;
		Little and Rubin, 2019). Recording which values were imputed, and
		keeping them out of the test set, keeps the estimate of the
		risk free of values that a hypothesis produced.

\subsection{Cross References}
missing data, tabular data, data point, feature, label, feature vector, training set, ERM, linear regression, squared error loss, baseline, test set

\subsection{References}
\begin{enumerate}
  \item Abayomi et al. (2008). Diagnostics for Multivariate Imputations. J. Roy. Statist. Soc.: Ser. C (Appl. Statist.), 57(3), pp.~273--291.
  \item GeoSphere Austria (2026). GeoSphere Austria climate station archive. Data hub, station historical resource klima-v2-1d. URL: https://dataset.api.hub.geosphere.at/v1/station/historical/klima-v2-1d.
  \item Horn and Johnson (2013). Matrix Analysis. 2nd ed., Cambridge Univ. Press, New York, NY, USA.
  \item Little and Rubin (2019). Statistical Analysis with Missing Data. 3rd ed., Wiley, Hoboken, NJ.
  \item Hastie et al. (2009). The Elements of Statistical Learning: Data Mining, Inference, and Prediction. 2nd ed., Springer Science+Business Media, New York, NY, USA.
\end{enumerate}

\end{document}
