File size: 33,851 Bytes
128403f fe0ccb0 128403f fe0ccb0 128403f fe0ccb0 128403f fe0ccb0 128403f fe0ccb0 128403f fe0ccb0 128403f fe0ccb0 128403f fe0ccb0 128403f fe0ccb0 128403f fe0ccb0 128403f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 |
%% 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} |