\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,amsthm,amsfonts,bbm,enumitem,mathtools,cancel}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage[capitalise,nameinlink]{cleveref}
\crefname{lemma}{Lemma}{Lemmas}
\crefname{fact}{Fact}{Facts}
\crefname{theorem}{Theorem}{Theorems}
\crefname{corollary}{Corollary}{Corollaries}
\crefname{claim}{Claim}{Claims}
\crefname{example}{Example}{Examples}
\crefname{problem}{Problem}{Problems}
\crefname{setting}{Setting}{Settings}
\crefname{definition}{Definition}{Definitions}
\crefname{assumption}{Assumption}{Assumptions}
\crefname{subsection}{Subsection}{Subsections}
\crefname{section}{Section}{Sections}

\DeclareMathOperator*{\E}{\mathbb{E}}
\let\Pr\relax
\DeclareMathOperator*{\Pr}{\mathbb{P}}

\newcommand{\eps}{\varepsilon}
\newcommand{\inprod}[1]{\left\langle #1 \right\rangle}
\newcommand{\R}{\mathbb{R}}

\newcommand{\handout}[5]{
  \noindent
  \begin{center}
  \framebox{
    \vbox{
      \hbox to 5.78in { {\bf CS 270: Combinatorial Algorithms and Data Structures
        } \hfill #2 }
      \vspace{4mm}
      \hbox to 5.78in { {\Large \hfill #5  \hfill} }
      \vspace{2mm}
      \hbox to 5.78in { {\em #3 \hfill #4} }
    }
  }
  \end{center}
  \vspace*{4mm}
}

\newcommand{\lecture}[4]{\handout{#1}{#2}{#3}{Scribe: #4}{Lecture #1}}

\newtheorem{theorem}{Theorem}[section]
\newtheorem*{theorem*}{Theorem}
\newtheorem{itheorem}{Theorem}

\newtheorem{subclaim}{Claim}[theorem]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem*{proposition*}{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem*{lemma*}{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem*{conjecture*}{Conjecture}
\newtheorem{fact}[theorem]{Fact}
\newtheorem*{fact*}{Fact}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem*{exercise*}{Exercise}
\newtheorem{hypothesis}[theorem]{Hypothesis}
\newtheorem*{hypothesis*}{Hypothesis}
\newtheorem{conjecture}[theorem]{Conjecture}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{setting}[theorem]{Setting}
\newtheorem{construction}[theorem]{Construction}
\newtheorem{example}[theorem]{Example}
\newtheorem{question}[theorem]{Question}
\newtheorem{openquestion}[theorem]{Open Question}
\newtheorem{algorithm}[theorem]{Algorithm}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{protocol}[theorem]{Protocol}
\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{exercise-easy}[theorem]{Exercise}
\newtheorem{exercise-med}[theorem]{Exercise}
\newtheorem{exercise-hard}[theorem]{Exercise$^\star$}
\newtheorem{claim}[theorem]{Claim}
\newtheorem*{claim*}{Claim}

\newtheorem{remark}[theorem]{Remark}
\newtheorem*{remark*}{Remark}
\newtheorem{observation}[theorem]{Observation}
\newtheorem*{observation*}{Observation}

% 1-inch margins, from fullpage.sty by H.Partl, Version 2, Dec. 15, 1988.
% \topmargin 0pt
% \advance \topmargin by -\headheight
% \advance \topmargin by -\headsep
% \textheight 8.9in
% \oddsidemargin 0pt
% \evensidemargin \oddsidemargin
% \marginparwidth 0.5in
% \textwidth 6.5in

% \parindent 0in
% \parskip 1.5ex

\newcommand{\argmin}{\operatornamewithlimits{argmin}}
\newcommand{\1}{\mathbbm{1}}

\begin{document}

\lecture{24 --- April 13, 2023}{Spring 2023}{Guest Lecturer: Michael Kim}{Alex Fu}

\section{Overview}

This lecture will be on more recent work in algorithms for machine learning, in particular questions of fairness in the context of prediction as well as multicalibration.



\section{Motivating example}

Suppose we are building a medical risk predictor, which takes as input an individual's health record and outputs a \textit{predicted probability} (of some health outcome) in $[0, 1]$. The following cartoon, from a 2019 paper by Obermeyer et al.\ \cite{Obermeyer19}, illustrates an example of unfairness and miscalibration --- the predicted probailities failed to accurately capture the actual probabilities. In order to be considered for advanced medical care, black patients needed to be much sicker than white patients to qualify.

\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{04-13.jpg}
    \caption{The predictor curves for different demographics of patients.}
\end{figure}

% $$\text{Individual health record} \longrightarrow \boxed{\text{Predictor}} \longrightarrow \text{Predicted probability (of some health outcome)}$$

% The ideal predictor is a slope $1$ line with intercept $0$.

% Reconstructing the actual probability is a tricky task, so let us take it for given. Given a list of individual's health covariance, looking across individuals with very similar health covariances, we compute the frequency for which outcomes were positive or negative.

% For different demographic groups, for white patients, the predictor curve lined up pretty well with ideal. For black patients, the curve was systematically right-shifted. $\tau_W^*$, the true threshold for the white patients, considerably lower than $\tau_B^*$ for the black patient. In order to be triaged, considered for advanced care, black patients needed to be much sicker than white patients to qualify. This is a type of unfairness and inaccuracy, because the risk scores were not capturing the actual probabilities.

% This is a sense in which people think they're using an objective threshold, but there is miscalibration.

% Covariates.

\clearpage



\section{Formal setup}

\begin{itemize}
    \item A domain $X \subseteq \{0, 1\}^d$, in which an individual $x \in X$ is given by $d$ boolean features.

    \item An outcome space $Y = \{0, 1\}$.

    \item A distribution $\mathcal{D}$ on $X \times Y$.

    \item A predictor $p \colon X \to [0, 1]$.

    \item An optimal predictor $p^*(x) = \Pr_\mathcal{D}(y = 1 \mid X = x)$, the ``actual probability'' from the example.
\end{itemize}

We will assume that $p^*$ has a distribution complicated enough that we cannot directly learn it to high precision. Typically, in supervised learning:

\begin{itemize}
    \item Fix a hypothesis class of predictors $\mathcal{H} \subseteq \{h \colon X \to [0, 1]\}$.

    \item \textit{Goal}: find $\argmin_{h \in \mathcal{H}} \E_\mathcal{D}[(h(x) - y)^2].$

    \item \textit{Concern}: this framework only cares about minimizing a single objective, so it may have errors concentrated on important demographic groups and may bias towards larger populations.

    \item \textit{New goal}: calibration.
\end{itemize}

\begin{definition} \label{defn:calibration}
    A predictor $p \colon X \to [0, 1]$ is \textbf{calibrated} if for all $v \in [0, 1]$,
    $$
        \Pr_\mathcal{D}(y = 1 \mid p(x) = v) \approx_\varepsilon v.
    $$
    $p$ is calibrated for $S \subseteq X$ if $\Pr_\mathcal{D}(y = 1 \mid p(x) = v, x \in S) \approx_\varepsilon v$. For a more precise definition, a predictor $p$ is \textit{$\alpha$-calibrated} if for all $v \in [0, 1]$,
    $$
        \left\lvert \E_\mathcal{D}[(y - v) \cdot \1\{p(x) = y\}] \right\rvert \leq \alpha(\varepsilon, v).
    $$
\end{definition}

Some motivation for \cref{defn:calibration} comes from forecasting: for a calibrated meteorologist, $70\%$ of the days where they predicted a $70\%$ risk of rain should be rainy days.

We can phrase our objection to unfair predictors through calibration. For instance, the predictor from \cite{Obermeyer19} is not well-calibrated for the subpopulation $S$ of black patients: $\E[y \mid p(x) = v, x \in S] \gg v$.

\begin{question}
    Is calibration enough?
\end{question}

Consider the predictor
$$
    p^\dagger(x) = \begin{cases}
        p^*(x) & x \notin S \\
        \mu_S & x \in S,
    \end{cases}
$$
where $\mu_S \coloneqq \E[y \mid x \in S]$ is the expected outcome of the group $S$. This is known as \textbf{algorithmic stereotyping}, where the algorithm overlooks the actual variation in the group and treats the group as a monolith.

\begin{claim}
    $p^\dagger$ is $0$-calibrated over $S$.
\end{claim}

\begin{proof}
    Note that the only supported value of $p^\dagger$ on $S$ is $\mu_S$.
    \begin{align*}
        \E[y \cdot \1\{p^\dagger(x) = \mu_S, x \in S\}]
            & = \E[y \cdot \1\{x \in S\}] \\
            & = \E[y \mid x \in S] \cdot \Pr(x \in S) \\
            & = \mu_S \cdot \Pr(x \in S) \\
            & = \E[\mu_S \cdot \1\{p^\dagger(x) = \mu_S, x \in S\}].
    \end{align*}
\end{proof}

In calibration, we can get away with treating a group as a monolith. Thus, calibration may be a necessary condition for fairness in prediction, but it is not enough alone.



\section{Multicalibration}

\begin{itemize}
    \item The individual-level $p^*$ is out of reach.
    \item Group calibration is too weak.
\end{itemize}

We will propose something in the middle: \textbf{multicalibration}. We calibrate not just on the whole population or on protected groups, but on groups we could hope to identify in the hypothesis class.

\begin{definition} \label{defn:mc}
    Fix a collection of subpopulations $\mathcal{C} \subseteq 2^X$. A predictor $\tilde{p}$ is \textbf{$(\mathcal{C}, \alpha)$-calibrated} if for all $S \in \mathcal{C}$ and for all $v \in \operatorname{support}(\tilde{p}) \subseteq [0, 1]$,
    \begin{equation}
        \Bigl\lvert \E[(y - \tilde{p}(x)) \cdot \1\{\tilde{p}(x) = v, x \in S\}] \Bigr\rvert \leq \alpha.
        \label{eqn:mc}
    \end{equation}
\end{definition}

\begin{question}
    For which $\mathcal{C}$ can we actually enforce calibration?
\end{question}

\noindent
\textit{Answer}: ``\textbf{Computationally identifiable}'' $\mathcal{C}$.

\begin{itemize}
    \item Set membership should be efficient. That is, for all $S \in \mathcal{C}$, $\1\{x \in S\}$ should be able to be evaluated efficiently.
    
    \item Auditing should be possible. Given a predictor $p$, we should be able to answer the question
    \begin{center}
        ``Does there exist a subpopulation $S \in \mathcal{C}$ that violates \cref{eqn:mc}?''
    \end{center}
\end{itemize}



\section{MCBoost algorithm}

The following \textit{multicalibration boosting} or \textit{HKRR} algorithm is an iterative learning algorithm originating from a paper by Hebert-Johnson, Kim, Reingold, and Rothblum \cite{HKRR18}.

% \clearpage

\begin{algorithm}[\textsf{MCBoost}]
    \leavevmode
    \begin{enumerate}
        \item Initialize $p_0(x) = \frac{1}{2}$ for all $x \in X$.
        \item Repeat for $t = 0, 1, 2, \ldots$:
        \item \qquad If there exists $S \in \mathcal{C}$ and $v \in [0, 1]$ such that $\lvert \E[(y - p_t(x)) \cdot \1\{p_t(x) = v, x \in S\}] \rvert > \alpha$:
        \item \qquad \qquad Update $p_{t+1}(x) \gets p_t(x) - \eta_t \cdot \1\{p_t(x) = v, x \in S\}$.
        \item \qquad Else:
        \item \qquad \qquad Return $\tilde{p} \coloneqq p_t$.
    \end{enumerate}
\end{algorithm}

\begin{claim}
    If \textsf{MCBoost} terminates, then $\tilde{p}$ is $(C, \alpha)$-multicalibrated.
\end{claim}

This is clear by \cref{defn:mc}, so the real question is why \textsf{MCBoost} terminates:

\begin{itemize}
    \item Number of iterations $T$.
    \item Complexity of auditing.
\end{itemize}

\begin{claim}
    Suppose for all $S \in \mathcal{C}$, $\1\{x \in S\}$ is computable in time $s$. Then $\tilde{p}(x)$ is computable in time $O(T \cdot s)$.
\end{claim}

\begin{lemma}
    \textsf{MCBoost} terminates in $T \leq O(\alpha^{-2})$ iterations.
\end{lemma}

\begin{proof}
    Define the potential function $\phi(p) \coloneqq \E[(p(x) - p^*(x))^2] \geq 0$. Because $\phi(p_0) = \frac{1}{4} \in O(1)$, it suffices to show that $\phi(p_t) - \phi(p_{t+1}) \geq \Omega(\alpha^2)$.
    \begin{align*}
        & \phi(p_t) - \phi(p_{t+1}) \\
            & = \phi(p_t) - \E[((p_t(x) - y) - \eta_t \cdot \1\{p_t(x) = v, x \in S\})^2] \\
            & = \cancel{\phi(p_t)} - \cancel{\phi(p_t)} - \eta_t^2 \cdot \E[\1\{p_t(x) = v, x \in S\}] + 2 \eta_t \cdot \E[(p_t(x) - y) \cdot \1\{p_t(x) = v, x \in S\}] \\
            & \geq -\alpha^2 + 2\alpha^2 \\
            & = \alpha^2,
    \end{align*}
    where $\lvert \E[(p_t(x) - y) \cdot \1\{p_t(x) = v, x \in S\}] \rvert > \alpha$ by the auditing step, so we can choose $\eta_t \in \{\pm \alpha\}$ according to the sign of $\E[(p_t(x) - y) \cdot \1[p_t(x) = v, x \in S]]$.
\end{proof}



\bibliographystyle{alpha}

\begin{thebibliography}{42}
    \bibitem{Obermeyer19}
    Ziad Obermeyer, Brian Powers, Christine Vogeli, Sendhil Mullainathan.
    \newblock Dissecting racial bias in an algorithm used to manage the health of populations.
    \newblock \textit{Science}, 366(6464):447--453, 2019.

    \bibitem{HKRR18}
    Ursula Hebert-Johnson, Michael Kim, Omer Reingold, Guy Rothblum.
    \newblock Multicalibration: Calibration for the (Computationally-Identifiable) Masses.
    \newblock \textit{Proceedings of the 35th International Conference on Machine Learning}, 80:1939--1948, 2018.
\end{thebibliography}

\end{document}