%% Generated by Sphinx.
\def\sphinxdocclass{report}
\documentclass[letterpaper,10pt,oneside,english]{sphinxmanual}
\ifdefined\pdfpxdimen
   \let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen
\fi \sphinxpxdimen=.75bp\relax
\ifdefined\pdfimageresolution
    \pdfimageresolution= \numexpr \dimexpr1in\relax/\sphinxpxdimen\relax
\fi
%% let collapsible pdf bookmarks panel have high depth per default
\PassOptionsToPackage{bookmarksdepth=5}{hyperref}

\PassOptionsToPackage{booktabs}{sphinx}
\PassOptionsToPackage{colorrows}{sphinx}

\PassOptionsToPackage{warn}{textcomp}
\usepackage[utf8]{inputenc}
\ifdefined\DeclareUnicodeCharacter
% support both utf8 and utf8x syntaxes
  \ifdefined\DeclareUnicodeCharacterAsOptional
    \def\sphinxDUC#1{\DeclareUnicodeCharacter{"#1}}
  \else
    \let\sphinxDUC\DeclareUnicodeCharacter
  \fi
  \sphinxDUC{00A0}{\nobreakspace}
  \sphinxDUC{2500}{\sphinxunichar{2500}}
  \sphinxDUC{2502}{\sphinxunichar{2502}}
  \sphinxDUC{2514}{\sphinxunichar{2514}}
  \sphinxDUC{251C}{\sphinxunichar{251C}}
  \sphinxDUC{2572}{\textbackslash}
\fi
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amstext}
\usepackage{babel}



\usepackage{tgtermes}
\usepackage{tgheros}
\renewcommand{\ttdefault}{txtt}



\usepackage[Bjarne]{fncychap}
\usepackage{sphinx}

\fvset{fontsize=auto}
\usepackage{geometry}


% Include hyperref last.
\usepackage{hyperref}
% Fix anchor placement for figures with captions.
\usepackage{hypcap}% it must be loaded after hyperref.
% Set up styles of URL: it should be placed after hyperref.
\urlstyle{same}

\addto\captionsenglish{\renewcommand{\contentsname}{Contents:}}

\usepackage{sphinxmessages}
\setcounter{tocdepth}{1}


    \DeclareUnicodeCharacter{03BC}{\textmu}
    \DeclareUnicodeCharacter{03C3}{\ensuremath{\sigma}}
    

\title{AIM\sphinxhyphen{}CU}
\date{Jul 25, 2025}
\release{1.0.0}
\author{Smriti Prathapan, Berkman Sahiner, Dhaval Kadia, Ravi K.\@{} Samala}
\newcommand{\sphinxlogo}{\vbox{}}
\renewcommand{\releasename}{Release}
\makeindex
\begin{document}

\ifdefined\shorthandoff
  \ifnum\catcode`\=\string=\active\shorthandoff{=}\fi
  \ifnum\catcode`\"=\active\shorthandoff{"}\fi
\fi

\pagestyle{empty}
\sphinxmaketitle
\pagestyle{plain}
\sphinxtableofcontents
\pagestyle{normal}
\phantomsection\label{\detokenize{index::doc}}


\sphinxAtStartPar
A CUSUM\sphinxhyphen{}based tool for AI Monitoring

\sphinxAtStartPar
Monitoring a clinically deployed AI device to detect performance drift is an essential step to ensure the safety and effectiveness of AI.

\sphinxAtStartPar
AIM\sphinxhyphen{}CU is a statistical tool for AI monitoring using cumulative sum (AIM\sphinxhyphen{}CU).

\sphinxAtStartPar
AIM\sphinxhyphen{}CU computes:
\begin{itemize}
\item {} 
\sphinxAtStartPar
The parameter choices for change\sphinxhyphen{}point detection based on an acceptable false alarm rate

\item {} 
\sphinxAtStartPar
Detection delay estimates for a given displacement of the performance metric from the target for those parameter choices.

\end{itemize}


\chapter{System setup}
\label{\detokenize{index:system-setup}}
\sphinxAtStartPar
Make sure R is installed in the system. Instructions for linux (the below setup is only performed in linux):

\begin{sphinxVerbatim}[commandchars=\\\{\}]
wget\PYG{+w}{ }\PYGZhy{}qO\PYGZhy{}\PYG{+w}{ }https://cloud.r\PYGZhy{}project.org/bin/linux/ubuntu/marutter\PYGZus{}pubkey.asc\PYG{+w}{ }\PYG{p}{|}\PYG{+w}{  }tee\PYG{+w}{ }\PYGZhy{}a\PYG{+w}{ }/etc/apt/trusted.gpg.d/cran\PYGZus{}ubuntu\PYGZus{}key.asc
add\PYGZhy{}apt\PYGZhy{}repository\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+s2}{deb https://cloud.r\PYGZhy{}project.org/bin/linux/ubuntu }\PYG{k}{\PYGZdl{}(}lsb\PYGZus{}release\PYG{+w}{ }\PYGZhy{}cs\PYG{k}{)}\PYG{l+s+s2}{\PYGZhy{}cran40/}\PYG{l+s+s2}{\PYGZdq{}}
apt\PYGZhy{}get\PYG{+w}{ }install\PYG{+w}{ }\PYGZhy{}y\PYG{+w}{ }\PYGZhy{}\PYGZhy{}no\PYGZhy{}install\PYGZhy{}recommends\PYG{+w}{ }r\PYGZhy{}base\PYG{+w}{ }r\PYGZhy{}base\PYGZhy{}dev

\PYG{c+c1}{\PYGZsh{} setup R configs}
\PYG{n+nb}{echo}\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}r \PYGZlt{}\PYGZhy{} getOption(\PYGZsq{}repos\PYGZsq{}); r[\PYGZsq{}CRAN\PYGZsq{}] \PYGZlt{}\PYGZhy{} \PYGZsq{}http://cran.us.r\PYGZhy{}project.org\PYGZsq{}; options(repos = r);\PYGZdq{}}\PYG{+w}{ }\PYGZgt{}\PYG{+w}{ }\PYGZti{}/.Rprofile
Rscript\PYG{+w}{ }\PYGZhy{}e\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}install.packages(\PYGZsq{}ggplot2\PYGZsq{})\PYGZdq{}}
Rscript\PYG{+w}{ }\PYGZhy{}e\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}install.packages(\PYGZsq{}hexbin\PYGZsq{})\PYGZdq{}}
Rscript\PYG{+w}{ }\PYGZhy{}e\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}install.packages(\PYGZsq{}lazyeval\PYGZsq{})\PYGZdq{}}
Rscript\PYG{+w}{ }\PYGZhy{}e\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}install.packages(\PYGZsq{}cusumcharter\PYGZsq{})\PYGZdq{}}
Rscript\PYG{+w}{ }\PYGZhy{}e\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}install.packages(\PYGZsq{}RcppCNPy\PYGZsq{})\PYGZdq{}}
Rscript\PYG{+w}{ }\PYGZhy{}e\PYG{+w}{ }\PYG{l+s+s2}{\PYGZdq{}install.packages(\PYGZsq{}spc\PYGZsq{})\PYGZdq{}}
\end{sphinxVerbatim}


\chapter{Code execution}
\label{\detokenize{index:code-execution}}
\sphinxAtStartPar
Clone AIM\sphinxhyphen{}CU repository.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
git\PYG{+w}{ }clone\PYG{+w}{ }https://github.com/DIDSR/AIM\PYGZhy{}CU.git
\end{sphinxVerbatim}

\sphinxAtStartPar
Run the following commands to install required dependencies (Python = 3.10 is used).

\begin{sphinxVerbatim}[commandchars=\\\{\}]
apt\PYGZhy{}get\PYG{+w}{ }\PYGZhy{}y\PYG{+w}{ }install\PYG{+w}{ }python3
apt\PYGZhy{}get\PYG{+w}{ }\PYGZhy{}y\PYG{+w}{ }install\PYG{+w}{ }pip
\PYG{n+nb}{cd}\PYG{+w}{ }AIM\PYGZhy{}CU
pip\PYG{+w}{ }install\PYG{+w}{ }\PYGZhy{}r\PYG{+w}{ }requirements.txt
\end{sphinxVerbatim}

\sphinxAtStartPar
Run AIM\sphinxhyphen{}CU.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n+nb}{cd}\PYG{+w}{ }src/package
python3\PYG{+w}{ }app.py
\end{sphinxVerbatim}

\sphinxAtStartPar
Open the URL \sphinxurl{http://0.0.0.0:7860} that is running the AIM\sphinxhyphen{}CU locally.


\chapter{Example code execution}
\label{\detokenize{index:example-code-execution}}
\sphinxAtStartPar
Example code can be run in a Jupyter Notebook after opening it with \sphinxcode{\sphinxupquote{jupyter notebook}} command from \sphinxcode{\sphinxupquote{/src/package/}} directory. The tool is designed to used through UI, not from console.


\chapter{Demo}
\label{\detokenize{index:demo}}
\sphinxAtStartPar
AIM\sphinxhyphen{}CU can also be run through the demo available at \sphinxurl{https://huggingface.co/spaces/didsr/AIM-CU}. If Space is paused, click on Restart button.


\chapter{Usability}
\label{\detokenize{index:usability}}\begin{itemize}
\item {} 
\sphinxAtStartPar
Example AI output CSV file is available as \sphinxurl{config/spec-60-60.csv} to be uploaded in monitoring phase.

\item {} 
\sphinxAtStartPar
Workflow instruction to run the tool is available at bottom\sphinxhyphen{}left of UI.

\item {} 
\sphinxAtStartPar
Sample UI output is available at \sphinxurl{assets/ui.png}.

\item {} 
\sphinxAtStartPar
Setting \sphinxcode{\sphinxupquote{control:save\_figure}} to \sphinxcode{\sphinxupquote{true}} from \sphinxhref{config/config.toml}{config.toml} will save tables and plots in \sphinxurl{figure/}.

\item {} 
\sphinxAtStartPar
Running AIM\sphinxhyphen{}CU does not take time longer than a few seconds, and it does not require GPU.

\end{itemize}


\chapter{AIM\sphinxhyphen{}CU}
\label{\detokenize{index:aim-cu}}
\sphinxstepscope


\section{Methods}
\label{\detokenize{ref_method:methods}}\label{\detokenize{ref_method::doc}}

\subsection{CUSUM parameters}
\label{\detokenize{ref_method:cusum-parameters}}

\begin{savenotes}\sphinxattablestart
\sphinxthistablewithglobalstyle
\centering
\sphinxcapstartof{table}
\sphinxthecaptionisattop
\sphinxcaption{CUSUM parameters}\label{\detokenize{ref_method:id1}}
\sphinxaftertopcaption
\begin{tabulary}{\linewidth}[t]{TT}
\sphinxtoprule
\sphinxstyletheadfamily 
\sphinxAtStartPar
Parameter
&\sphinxstyletheadfamily 
\sphinxAtStartPar
Description
\\
\sphinxmidrule
\sphinxtableatstartofbodyhook
\sphinxAtStartPar
μ\_in
&
\sphinxAtStartPar
The mean of the performance metric when the process is in\sphinxhyphen{}control, i.e., when there is no performance drift
\\
\sphinxhline
\sphinxAtStartPar
ARL\_0
&
\sphinxAtStartPar
Number of observations before the control chart signals a false detection
\\
\sphinxhline
\sphinxAtStartPar
σ\_in
&
\sphinxAtStartPar
The in\sphinxhyphen{}control standard deviation of the metric
\\
\sphinxhline
\sphinxAtStartPar
ARL\_1
&
\sphinxAtStartPar
Number of observations before the control chart signals a true detection
\\
\sphinxhline
\sphinxAtStartPar
k
&
\sphinxAtStartPar
The normalized reference value, which is related to the magnitude of change that one is interested in detecting. k = 0.5 is the default choice for detecting a unit standard deviation change
\\
\sphinxhline
\sphinxAtStartPar
S\_hi
&
\sphinxAtStartPar
Cumulative sum of positive changes in the metric
\\
\sphinxhline
\sphinxAtStartPar
h
&
\sphinxAtStartPar
The normalized threshold or control limit (default =4). This threshold determines when the control chart signals a detection
\\
\sphinxhline
\sphinxAtStartPar
S\_lo
&
\sphinxAtStartPar
Cumulative sum of negative changes in the metric
\\
\sphinxbottomrule
\end{tabulary}
\sphinxtableafterendhook\par
\sphinxattableend\end{savenotes}


\subsection{CUSUM chart}
\label{\detokenize{ref_method:cusum-chart}}
\sphinxAtStartPar
A two\sphinxhyphen{}sided CUSUM control chart computes the cumulative differences or
deviations of individual observations from the target mean (or
in\sphinxhyphen{}control mean, \(\mu_{in}\)). The positive and negative cumulative
sums are calculated:
\begin{equation*}
\begin{split}\\ S_{hi}(d) = max(0, S_{hi}(d-1) + x_d  - \hat{\mu}_{in} - K)
\\ S_{lo}(d) = max(0, S_{lo}(d-1) - x_d +  \hat{\mu}_{in} - K)\end{split}
\end{equation*}
\sphinxAtStartPar
where \sphinxstyleemphasis{d} denotes a unit of time, \(x_d\) is the value of quantity
being monitored at time \(d\), \(\hat{\mu}_{in}\) is the
in\sphinxhyphen{}control mean of \(x_d\), and \(K\) is a “reference value”
related to the magnitude of change that one is interested in detecting.
\(S_{hi}\) and \(S_{lo}\) are the cumulative sum of positive and
negative changes. To detect a change in the observed values from the
in\sphinxhyphen{}control mean, the CUSUM scheme accumulates deviations that are
\(K\) units away from the in\sphinxhyphen{}control mean. Let \(\sigma_{in}\)
denote the in\sphinxhyphen{}control standard deviation of \(x_d\).

\sphinxstepscope


\section{CUSUM}
\label{\detokenize{ref_cusum:module-package.cusum}}\label{\detokenize{ref_cusum:cusum}}\label{\detokenize{ref_cusum::doc}}\index{module@\spxentry{module}!package.cusum@\spxentry{package.cusum}}\index{package.cusum@\spxentry{package.cusum}!module@\spxentry{module}}
\sphinxAtStartPar
Cumulative Sum (CUSUM)

\sphinxAtStartPar
@author: smriti.prathapan
\index{CUSUM (class in package.cusum)@\spxentry{CUSUM}\spxextra{class in package.cusum}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM}}
\pysigstartsignatures
\pysigline
{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{package.cusum.}}\sphinxbfcode{\sphinxupquote{CUSUM}}}
\pysigstopsignatures
\sphinxAtStartPar
CUSUM class and its functionalities.
\index{change\_detection() (package.cusum.CUSUM method)@\spxentry{change\_detection()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.change_detection}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{change\_detection}}}
{\sphinxparam{\DUrole{n}{normalized\_ref\_value}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}\DUrole{w}{ }\DUrole{o}{=}\DUrole{w}{ }\DUrole{default_value}{0.5}}\sphinxparamcomma \sphinxparam{\DUrole{n}{normalized\_threshold}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}\DUrole{w}{ }\DUrole{o}{=}\DUrole{w}{ }\DUrole{default_value}{4}}}
{{ $\rightarrow$ None}}
\pysigstopsignatures
\sphinxAtStartPar
Detects a change in the process.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}\begin{itemize}
\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{pre\_change\_days}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} Number of days for in\sphinxhyphen{}control phase.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{normalized\_ref\_value}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{, }}\sphinxstyleliteralemphasis{\sphinxupquote{optional}}) \textendash{} Normalized reference value for detecting a unit standard deviation change in mean of the process. Defaults to 0.5.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{normalized\_threshold}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{, }}\sphinxstyleliteralemphasis{\sphinxupquote{optional}}) \textendash{} Normalized threshold. Defaults to 4.

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}

\index{compute\_cusum() (package.cusum.CUSUM method)@\spxentry{compute\_cusum()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.compute_cusum}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{compute\_cusum}}}
{\sphinxparam{\DUrole{n}{x}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{list\DUrole{p}{{[}}float\DUrole{p}{{]}}}}\sphinxparamcomma \sphinxparam{\DUrole{n}{mu\_0}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}\sphinxparamcomma \sphinxparam{\DUrole{n}{k}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}}
{{ $\rightarrow$ tuple\DUrole{p}{{[}}list\DUrole{p}{{[}}float\DUrole{p}{{]}}\DUrole{p}{,}\DUrole{w}{ }list\DUrole{p}{{[}}float\DUrole{p}{{]}}\DUrole{p}{,}\DUrole{w}{ }list\DUrole{p}{{[}}float\DUrole{p}{{]}}\DUrole{p}{{]}}}}
\pysigstopsignatures
\sphinxAtStartPar
Compute CUSUM for the observations in x
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}\begin{itemize}
\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{x}} (\sphinxstyleliteralemphasis{\sphinxupquote{list}}\sphinxstyleliteralemphasis{\sphinxupquote{{[}}}\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{{]}}}) \textendash{} Performance metric to be monitored

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{mu\_0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} In\sphinxhyphen{}control mean of the observations/performance metric

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{k}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Reference value related to the magnitude of change that one is interested in detecting

\end{itemize}

\sphinxlineitem{Returns}
\sphinxAtStartPar
Positive cumulative sum, negative cumulative sum, and CUSUM

\sphinxlineitem{Return type}
\sphinxAtStartPar
tuple{[}list{[}float{]}, list{[}float{]}, list{[}float{]}{]}

\end{description}\end{quote}

\end{fulllineitems}

\index{initialize() (package.cusum.CUSUM method)@\spxentry{initialize()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.initialize}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{initialize}}}
{}
{{ $\rightarrow$ None}}
\pysigstopsignatures
\sphinxAtStartPar
Initialize with the configuration file.

\end{fulllineitems}

\index{plot\_cusum\_plotly() (package.cusum.CUSUM method)@\spxentry{plot\_cusum\_plotly()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.plot_cusum_plotly}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{plot\_cusum\_plotly}}}
{}
{{ $\rightarrow$ Figure}}
\pysigstopsignatures
\sphinxAtStartPar
Plot CUSUM value using Plotly
\begin{quote}\begin{description}
\sphinxlineitem{Returns}
\sphinxAtStartPar
CUSUM plot using Plotly graph object.

\sphinxlineitem{Return type}
\sphinxAtStartPar
go.Figure

\end{description}\end{quote}

\end{fulllineitems}

\index{plot\_input\_metric\_plotly() (package.cusum.CUSUM method)@\spxentry{plot\_input\_metric\_plotly()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.plot_input_metric_plotly}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{plot\_input\_metric\_plotly}}}
{}
{{ $\rightarrow$ Figure}}
\pysigstopsignatures
\sphinxAtStartPar
Plot the input metric using Plotly.
\begin{quote}\begin{description}
\sphinxlineitem{Returns}
\sphinxAtStartPar
Scatter plot as Plotly graph object.

\sphinxlineitem{Return type}
\sphinxAtStartPar
go.Figure

\end{description}\end{quote}

\end{fulllineitems}

\index{plot\_input\_metric\_plotly\_raw() (package.cusum.CUSUM method)@\spxentry{plot\_input\_metric\_plotly\_raw()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.plot_input_metric_plotly_raw}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{plot\_input\_metric\_plotly\_raw}}}
{}
{{ $\rightarrow$ Figure}}
\pysigstopsignatures
\sphinxAtStartPar
Plot AI output using Plotly.
\begin{quote}\begin{description}
\sphinxlineitem{Returns}
\sphinxAtStartPar
Scatter plot as Plotly graph object.

\sphinxlineitem{Return type}
\sphinxAtStartPar
go.Figure

\end{description}\end{quote}

\end{fulllineitems}

\index{set\_df\_metric\_csv() (package.cusum.CUSUM method)@\spxentry{set\_df\_metric\_csv()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.set_df_metric_csv}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{set\_df\_metric\_csv}}}
{\sphinxparam{\DUrole{n}{data\_csv}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{DataFrame}}}
{{ $\rightarrow$ None}}
\pysigstopsignatures
\sphinxAtStartPar
Assign the performance metric data to be used for CUSUM.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{data\_csv}} (\sphinxstyleliteralemphasis{\sphinxupquote{DataFrame}}\sphinxstyleliteralemphasis{\sphinxupquote{ or }}\sphinxstyleliteralemphasis{\sphinxupquote{TextFileReader}}) \textendash{} A comma\sphinxhyphen{}separated values (csv) file is returned as two\sphinxhyphen{}dimensional data structure with labeled axes.

\end{description}\end{quote}

\end{fulllineitems}

\index{set\_df\_metric\_default() (package.cusum.CUSUM method)@\spxentry{set\_df\_metric\_default()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.set_df_metric_default}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{set\_df\_metric\_default}}}
{}
{{ $\rightarrow$ None}}
\pysigstopsignatures
\sphinxAtStartPar
Read the provided performance metric data to be used for CUSUM for an example.

\end{fulllineitems}

\index{set\_init\_stats() (package.cusum.CUSUM method)@\spxentry{set\_init\_stats()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.set_init_stats}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{set\_init\_stats}}}
{\sphinxparam{\DUrole{n}{init\_days}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{int}}}
{{ $\rightarrow$ None}}
\pysigstopsignatures
\sphinxAtStartPar
Use number of baseline observations to calculate in\sphinxhyphen{}control mean and standard deviation.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{init\_days}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}\sphinxstyleliteralemphasis{\sphinxupquote{, }}\sphinxstyleliteralemphasis{\sphinxupquote{optional}}) \textendash{} Number of baseline observations when observations are considered stable. Defaults to 30.

\end{description}\end{quote}

\end{fulllineitems}

\index{set\_timeline() (package.cusum.CUSUM method)@\spxentry{set\_timeline()}\spxextra{package.cusum.CUSUM method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_cusum:package.cusum.CUSUM.set_timeline}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxbfcode{\sphinxupquote{set\_timeline}}}
{\sphinxparam{\DUrole{n}{data}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{ndarray}}}
{{ $\rightarrow$ None}}
\pysigstopsignatures
\sphinxAtStartPar
Set the timeline of observations.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{data}} (\sphinxstyleliteralemphasis{\sphinxupquote{np.ndarray}}) \textendash{} Data of the metric values across the observations.

\end{description}\end{quote}

\end{fulllineitems}


\end{fulllineitems}


\sphinxstepscope


\section{ARLTheoretical}
\label{\detokenize{ref_theoretical:module-package.ARLTheoretical}}\label{\detokenize{ref_theoretical:arltheoretical}}\label{\detokenize{ref_theoretical::doc}}\index{module@\spxentry{module}!package.ARLTheoretical@\spxentry{package.ARLTheoretical}}\index{package.ARLTheoretical@\spxentry{package.ARLTheoretical}!module@\spxentry{module}}
\sphinxAtStartPar
ARLTheoretical

\sphinxAtStartPar
@author: smriti.prathapan
\index{get\_ARL\_1() (in module package.ARLTheoretical)@\spxentry{get\_ARL\_1()}\spxextra{in module package.ARLTheoretical}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_theoretical:package.ARLTheoretical.get_ARL_1}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxcode{\sphinxupquote{package.ARLTheoretical.}}\sphinxbfcode{\sphinxupquote{get\_ARL\_1}}}
{\sphinxparam{\DUrole{n}{h}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}\sphinxparamcomma \sphinxparam{\DUrole{n}{shift\_in\_mean}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{list\DUrole{p}{{[}}float\DUrole{p}{{]}}}}\sphinxparamcomma \sphinxparam{\DUrole{n}{dict\_ARL0\_k}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{OrderedDict}}}
{{ $\rightarrow$ DataFrame}}
\pysigstopsignatures
\sphinxAtStartPar
Get the ARL1 along with k values.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}\begin{itemize}
\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{h}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Normalized threshold.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{shift\_in\_mean}} (\sphinxstyleliteralemphasis{\sphinxupquote{list}}\sphinxstyleliteralemphasis{\sphinxupquote{{[}}}\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{{]}}}) \textendash{} List of the values of shift in mean.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{dict\_ARL0\_k}} (\sphinxstyleliteralemphasis{\sphinxupquote{OrderedDict}}) \textendash{} Data dictionary of ARL0 and k

\end{itemize}

\sphinxlineitem{Returns}
\sphinxAtStartPar
Table for ARL1 and k values.

\sphinxlineitem{Return type}
\sphinxAtStartPar
pd.DataFrame

\end{description}\end{quote}

\end{fulllineitems}

\index{get\_ARL\_1\_h\_mu1\_k() (in module package.ARLTheoretical)@\spxentry{get\_ARL\_1\_h\_mu1\_k()}\spxextra{in module package.ARLTheoretical}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_theoretical:package.ARLTheoretical.get_ARL_1_h_mu1_k}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxcode{\sphinxupquote{package.ARLTheoretical.}}\sphinxbfcode{\sphinxupquote{get\_ARL\_1\_h\_mu1\_k}}}
{\sphinxparam{\DUrole{n}{h}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}\sphinxparamcomma \sphinxparam{\DUrole{n}{k}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}\sphinxparamcomma \sphinxparam{\DUrole{n}{mu1}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}}
{{ $\rightarrow$ float}}
\pysigstopsignatures
\sphinxAtStartPar
Calculate ARL\_1 with given Shift in Mean (mu1) and k.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}\begin{itemize}
\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{h}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Normalized threshold.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{k}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Normalized reference value.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{mu1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Intended shift in mean.

\end{itemize}

\sphinxlineitem{Returns}
\sphinxAtStartPar
Detection delay (ARL1).

\sphinxlineitem{Return type}
\sphinxAtStartPar
float

\end{description}\end{quote}

\end{fulllineitems}

\index{get\_ref\_value() (in module package.ARLTheoretical)@\spxentry{get\_ref\_value()}\spxextra{in module package.ARLTheoretical}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_theoretical:package.ARLTheoretical.get_ref_value}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxcode{\sphinxupquote{package.ARLTheoretical.}}\sphinxbfcode{\sphinxupquote{get\_ref\_value}}}
{\sphinxparam{\DUrole{n}{h}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}\sphinxparamcomma \sphinxparam{\DUrole{n}{list\_ARL\_0}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{list\DUrole{p}{{[}}float\DUrole{p}{{]}}}}}
{{ $\rightarrow$ tuple\DUrole{p}{{[}}DataFrame\DUrole{p}{,}\DUrole{w}{ }OrderedDict\DUrole{p}{{]}}}}
\pysigstopsignatures
\sphinxAtStartPar
provides normalized reference values k for provided list of ARL0, given the value of normalized threshold h.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}\begin{itemize}
\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{h}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Normalized threshold.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{list\_ARL\_0}} (\sphinxstyleliteralemphasis{\sphinxupquote{list}}) \textendash{} List of ARL0 values.

\end{itemize}

\sphinxlineitem{Returns}
\sphinxAtStartPar
Dataframe of ARL0 and k, Data dictionary of ARL0 and k; where k is normalized reference value.

\sphinxlineitem{Return type}
\sphinxAtStartPar
tuple{[}pd.Dataframe, OrderedDict{]}

\end{description}\end{quote}

\end{fulllineitems}

\index{get\_ref\_value\_k() (in module package.ARLTheoretical)@\spxentry{get\_ref\_value\_k()}\spxextra{in module package.ARLTheoretical}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_theoretical:package.ARLTheoretical.get_ref_value_k}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxcode{\sphinxupquote{package.ARLTheoretical.}}\sphinxbfcode{\sphinxupquote{get\_ref\_value\_k}}}
{\sphinxparam{\DUrole{n}{h}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}\sphinxparamcomma \sphinxparam{\DUrole{n}{ARL\_0}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{float}}}
{{ $\rightarrow$ float}}
\pysigstopsignatures
\sphinxAtStartPar
Calculation for the reference value for given h and ARL\_0.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}\begin{itemize}
\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{h}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Normalized threshold.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{ARL\_0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} ARL0 value.

\end{itemize}

\sphinxlineitem{Returns}
\sphinxAtStartPar
Normalized reference value k.

\sphinxlineitem{Return type}
\sphinxAtStartPar
float

\end{description}\end{quote}

\end{fulllineitems}


\sphinxstepscope


\section{Utils}
\label{\detokenize{ref_utils:module-package.utils}}\label{\detokenize{ref_utils:utils}}\label{\detokenize{ref_utils::doc}}\index{module@\spxentry{module}!package.utils@\spxentry{package.utils}}\index{package.utils@\spxentry{package.utils}!module@\spxentry{module}}
\sphinxAtStartPar
Utilities to handle different operations
\index{get\_greattable\_as\_html() (in module package.utils)@\spxentry{get\_greattable\_as\_html()}\spxextra{in module package.utils}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_utils:package.utils.get_greattable_as_html}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxcode{\sphinxupquote{package.utils.}}\sphinxbfcode{\sphinxupquote{get\_greattable\_as\_html}}}
{\sphinxparam{\DUrole{n}{df}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{DataFrame}}}
{{ $\rightarrow$ GT}}
\pysigstopsignatures
\sphinxAtStartPar
Get the great\_table as HTML from Pandas dataframe.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{df}} (\sphinxstyleliteralemphasis{\sphinxupquote{pd.DataFrame}}) \textendash{} Dataframe to rendera as a table.

\sphinxlineitem{Returns}
\sphinxAtStartPar
Table in HTML format.

\sphinxlineitem{Return type}
\sphinxAtStartPar
gt.GT

\end{description}\end{quote}

\end{fulllineitems}

\index{populate\_summary\_table\_ARL0\_k() (in module package.utils)@\spxentry{populate\_summary\_table\_ARL0\_k()}\spxextra{in module package.utils}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_utils:package.utils.populate_summary_table_ARL0_k}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxcode{\sphinxupquote{package.utils.}}\sphinxbfcode{\sphinxupquote{populate\_summary\_table\_ARL0\_k}}}
{\sphinxparam{\DUrole{n}{summary\_table\_df\_ARL0\_k}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{DataFrame}}\sphinxparamcomma \sphinxparam{\DUrole{n}{h}}}
{{ $\rightarrow$ GT}}
\pysigstopsignatures
\sphinxAtStartPar
Populate ARLTheoretical.summary\_table\_df\_ARL0\_k.
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}\begin{itemize}
\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{summary\_table\_df\_ARL0\_k}} (\sphinxstyleliteralemphasis{\sphinxupquote{pd.DataFrame}}) \textendash{} Dataframe of ARL0 and its respective values of k.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{h}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Normalized threshold.

\end{itemize}

\sphinxlineitem{Returns}
\sphinxAtStartPar
Table of ARL0 and k in HTML format.

\sphinxlineitem{Return type}
\sphinxAtStartPar
gt.GT

\end{description}\end{quote}

\end{fulllineitems}

\index{populate\_summary\_table\_ARL1\_k() (in module package.utils)@\spxentry{populate\_summary\_table\_ARL1\_k()}\spxextra{in module package.utils}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{ref_utils:package.utils.populate_summary_table_ARL1_k}}
\pysigstartsignatures
\pysiglinewithargsret
{\sphinxcode{\sphinxupquote{package.utils.}}\sphinxbfcode{\sphinxupquote{populate\_summary\_table\_ARL1\_k}}}
{\sphinxparam{\DUrole{n}{summary\_table\_df\_ARL1\_k}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{DataFrame}}\sphinxparamcomma \sphinxparam{\DUrole{n}{dict\_ARL0\_k}\DUrole{p}{:}\DUrole{w}{ }\DUrole{n}{OrderedDict}}\sphinxparamcomma \sphinxparam{\DUrole{n}{h}}}
{{ $\rightarrow$ GT}}
\pysigstopsignatures
\sphinxAtStartPar
Populate Multiindex table specific for ARLTheoretical.summary\_table\_df\_ARL1\_k
\begin{quote}\begin{description}
\sphinxlineitem{Parameters}\begin{itemize}
\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{summary\_table\_df\_ARL1\_k}} (\sphinxstyleliteralemphasis{\sphinxupquote{pd.DataFrame}}) \textendash{} Dataframe with ARL1 and k values.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{dict\_ARL0\_k}} (\sphinxstyleliteralemphasis{\sphinxupquote{OrderedDict}}) \textendash{} Data Dictionary with the mapping between ARL0 and k.

\item {} 
\sphinxAtStartPar
\sphinxstyleliteralstrong{\sphinxupquote{h}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Normalized threshold.

\end{itemize}

\sphinxlineitem{Returns}
\sphinxAtStartPar
Table for ARL1 and k in HTML format.

\sphinxlineitem{Return type}
\sphinxAtStartPar
gt.GT

\end{description}\end{quote}

\end{fulllineitems}



\chapter{Disclaimer}
\label{\detokenize{index:disclaimer}}
\sphinxAtStartPar
This software and documentation was developed at the Food and Drug Administration (FDA) by employees of the Federal Government in the course of their official duties. Pursuant to Title 17, Section 105 of the United States Code, this work is not subject to copyright protection and is in the public domain. Permission is hereby granted, free of charge, to any person obtaining a copy of the Software, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, or sell copies of the Software or derivatives, and to permit persons to whom the Software is furnished to do so. FDA assumes no responsibility whatsoever for use by other parties of the Software, its source code, documentation or compiled executables, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic. Further, use of this code in no way implies endorsement by the FDA or confers any advantage in regulatory decisions. Although this software can be redistributed and/or modified freely, we ask that any derivative works bear some notice that they are derived from it, and any modified versions bear some notice that they have been modified.


\renewcommand{\indexname}{Python Module Index}
\begin{sphinxtheindex}
\let\bigletter\sphinxstyleindexlettergroup
\bigletter{p}
\item\relax\sphinxstyleindexentry{package.ARLTheoretical}\sphinxstyleindexpageref{ref_theoretical:\detokenize{module-package.ARLTheoretical}}
\item\relax\sphinxstyleindexentry{package.cusum}\sphinxstyleindexpageref{ref_cusum:\detokenize{module-package.cusum}}
\item\relax\sphinxstyleindexentry{package.utils}\sphinxstyleindexpageref{ref_utils:\detokenize{module-package.utils}}
\end{sphinxtheindex}

\renewcommand{\indexname}{Index}
\printindex
\end{document}