2025-08-13 15:04:44 +02:00
\documentclass [tikz,border=10pt] { standalone}
\usepackage { tikz}
2025-09-28 16:12:24 +02:00
\usepackage { amsfonts}
2025-08-13 15:04:44 +02:00
\usetikzlibrary { positioning, shapes.geometric, fit, arrows, arrows.meta, backgrounds}
% Define box styles
\tikzset {
databox/.style={ rectangle, align=center, draw=black, fill=blue!50, thick, rounded corners} ,%, inner sep=4},
procbox/.style={ rectangle, align=center, draw=black, fill=orange!30, thick, rounded corners} ,
hyperbox/.style={ rectangle, align=center, draw=black, fill=green!30, thick, rounded corners} ,
2025-09-28 16:12:24 +02:00
stepsbox/.style={ rectangle, align=left, draw=black,fill=white, rounded corners, minimum width=5.2cm, minimum height=1.5cm, font=\small } ,
outputbox/.style={ rectangle, align=center, draw=red!80, fill=red!20, rounded corners, minimum width=5.2cm, minimum height=1.5cm, font=\small } ,
hlabelbox/.style={ rectangle, align=center, draw=black,fill=white, rounded corners, minimum width=5.2cm, minimum height=1.5cm, font=\small } ,
2025-08-13 15:04:44 +02:00
vlabelbox/.style={ rectangle, align=center, draw=black,fill=white, rounded corners, minimum width=3cm, minimum height=1.8cm, font=\small } ,
arrow/.style={ -{ Latex[length=3mm]} } ,
arrowlabel/.style={ fill=white,inner sep=2pt,midway}
}
\newcommand { \boxtitle } [1]{ \textbf { #1} \\ [.4em] }
\pgfdeclarelayer { background}
\pgfdeclarelayer { foreground}
\pgfsetlayers { background,main,foreground}
\begin { document}
\begin { tikzpicture} [node distance=1cm and 2cm]
\node (data) { Data} ;
2025-09-28 16:12:24 +02:00
\node [right=4.9 of data] (process) { Procedure} ;
\node [right=4.1 of process] (hyper) { Hyperparameters} ;
2025-08-13 15:04:44 +02:00
\begin { pgfonlayer} { foreground}
2025-09-28 16:12:24 +02:00
\node [hlabelbox, below=1.29 of data] (unlabeled) { \boxtitle { Unlabeled Data} Significantly more normal than \\ anomalous samples required} ;
2025-08-13 15:04:44 +02:00
\node [hlabelbox, below=.1 of unlabeled] (labeled) { \boxtitle { Labeled Data} No requirement regarding ratio \\ +1 = normal, -1 = anomalous} ;
\end { pgfonlayer}
\begin { pgfonlayer} { background}
\node [databox, fit=(unlabeled) (labeled), label={[label distance = 1, name=traindatalabel] above:{ \textbf { Training Data} } } ] (traindata) { } ;
\end { pgfonlayer}
%\draw[arrow] (latent.east) -- node{} (autoenc.west);
\begin { pgfonlayer} { foreground}
2025-09-28 18:58:03 +02:00
\node [stepsbox, below=of process] (pretrainproc) { Train Autoencoder $ \mathcal { \phi } _ { AE } $ \\ optimize Autoencoding Objective \\ for $ E _ A $ Epochs \\ with $ L _ A $ Learning Rate \\ No Labels Used / Required} ;
\node [outputbox, below=.1 of pretrainproc] (pretrainout) { \boxtitle { Outputs} $ \mathcal { \phi } $ : Encoder / DeepSAD Network \\ $ \mathcal { W } _ E $ : Encoder Network Weights} ;
2025-08-13 15:04:44 +02:00
\end { pgfonlayer}
\begin { pgfonlayer} { background}
\node [procbox, fit=(pretrainproc) (pretrainout), label={[label distance = 1, name=pretrainlab] above:{ \textbf { Pre-Training of Autoencoder} } } ] (pretrain) { } ;
\end { pgfonlayer}
\begin { pgfonlayer} { foreground}
2025-09-28 18:58:03 +02:00
\node [hlabelbox, below=1.26 of hyper] (autoencarch) { \boxtitle { Autoencoder Architecture} $ \mathcal { \phi } _ { AE } $ : Autoencoder Network \\ $ \mathbb { R } ^ d $ : Latent Space Size } ;
2025-09-28 16:12:24 +02:00
\node [hlabelbox, below=.1 of autoencarch] (pretrainhyper) { \boxtitle { Hyperparameters} $ E _ A $ : Number of Epochs \\ $ L _ A $ : Learning Rate AE} ;
2025-08-13 15:04:44 +02:00
\end { pgfonlayer}
\begin { pgfonlayer} { background}
\node [hyperbox, fit=(autoencarch) (pretrainhyper), label={[label distance = 1, name=autoenclabel] above:{ \textbf { Pre-Training Hyperparameters} } } ] (pretrainhyp) { } ;
\end { pgfonlayer}
\draw [arrow] (pretrainhyp.west) -- (pretrain.east);
%\draw[arrow] (node cs:name=traindata,angle=10) -- node[arrowlabel]{data type} (node cs:name=autoenc,angle=177);
% \draw[arrow] (node cs:name=autoenc,angle=196) |- (node cs:name=pretrain,angle=5);
\begin { pgfonlayer} { foreground}
2025-09-28 18:58:03 +02:00
\node [stepsbox, below=1.4 of pretrain] (calccproc) { Init Network $ \mathcal { \phi } $ with $ \mathcal { W } _ E $ \\ Forward Pass on all data \\ Hypersphere center $ \mathbf { c } $ is mean \\ of all Latent Representation} ;
2025-08-13 15:04:44 +02:00
\node [outputbox, below=.1 of calccproc] (calccout) { \boxtitle { Outputs} $ \mathbf { c } $ : Hypersphere Center} ;
\end { pgfonlayer}
\begin { pgfonlayer} { background}
\node [procbox, fit=(calccproc) (calccout), label={[label distance = 1, name=calcclab] above:{ \textbf { Calculate Hypersphere Center} } } ] (calcc) { } ;
\end { pgfonlayer}
\draw [arrow] (pretrain.south) -- (calcclab.north);
\draw [arrow] (traindata.east) -- (pretrain.west);
\draw [arrow] (traindata.south) |- (calcc.west);
%\draw[arrow] (node cs:name=traindata,angle=45) |- node[arrowlabel]{all training data, labels removed} (node cs:name=pretrain,angle=160);
%\draw[arrow] (node cs:name=traindata,angle=-45) |- node[arrowlabel]{all training data, labels removed} (node cs:name=calcc,angle=200);
\begin { pgfonlayer} { foreground}
2025-09-28 18:58:03 +02:00
\node [stepsbox, below=1.4 of calcc] (maintrainproc) { Init Network $ \mathcal { \phi } $ with $ \mathcal { W } _ E $ \\ Train Network $ \mathcal { \phi } $ \\ optimize DeepSAD Objective\\ for $ E _ M $ Epochs \\ with $ L _ M $ Learning Rate \\ Considers Labels with $ \eta $ strength} ;
\node [outputbox, below=.1 of maintrainproc] (maintrainout) { \boxtitle { Outputs} $ \mathcal { \phi } $ : DeepSAD Network \\ $ \mathcal { W } $ : DeepSAD Network Weights \\ $ \mathbf { c } $ : Hypersphere Center} ;
2025-08-13 15:04:44 +02:00
\end { pgfonlayer}
\begin { pgfonlayer} { background}
\node [procbox, fit=(maintrainproc) (maintrainout), label={[label distance = 1, name=maintrainlab] above:{ \textbf { Main Training} } } ] (maintrain) { } ;
\end { pgfonlayer}
\begin { pgfonlayer} { foreground}
2025-09-28 16:12:24 +02:00
\node [hlabelbox, below=12.48 of hyper] (maintrainhyper) { $ E _ M $ : Number of Epochs \\ $ L _ M $ : Learning Rate \\ $ \eta $ : Weight Labeled/Unlabeled} ;
2025-08-13 15:04:44 +02:00
\end { pgfonlayer}
\begin { pgfonlayer} { background}
\node [hyperbox, fit=(maintrainhyper), label={[label distance = 1, name=autoenclabel] above:{ \textbf { Main-Training Hyperparameters} } } ] (maintrainhyp) { } ;
\end { pgfonlayer}
2025-09-28 16:12:24 +02:00
\draw [arrow] (node cs:name=pretrain,angle=-50) |- +(1.5, -0.55) -- +(1.5,-5.4) -| (node cs:name=maintrain,angle=50);
2025-08-13 15:04:44 +02:00
%\draw[arrow] (pretrainoutput.south) -- (node cs:name=maintrain,angle=22);
\draw [arrow] (calcc.south) -- (maintrainlab.north);
\draw [arrow] (traindata.south) |- (maintrain.west);
%\draw[arrow] (node cs:name=traindata,angle=-135) |- node[arrowlabel]{all training data, including labels} (maintrain.west);
\draw [arrow] (maintrainhyp.west) -- (maintrain.east);
\begin { pgfonlayer} { foreground}
2025-09-28 18:58:03 +02:00
\node [stepsbox, below=1.4 of maintrain] (inferenceproc) { Init Network $ \mathcal { \phi } $ with $ \mathcal { W } $ \\ Forward Pass on sample = $ \mathbf { p } $ \\ Calculate Distance $ \mathbf { p } \rightarrow \mathbf { c } $ \\ Distance = Anomaly Score} ;
2025-08-13 15:04:44 +02:00
\node [outputbox, below=.1 of inferenceproc] (inferenceout) { \boxtitle { Outputs} Anomaly Score (Analog Value) \\ Higher for Anomalies} ;
\end { pgfonlayer}
\begin { pgfonlayer} { background}
\node [procbox, fit=(inferenceproc) (inferenceout), label={[label distance = 1, name=inferencelab] above:{ \textbf { Inference} } } ] (inference) { } ;
\end { pgfonlayer}
\begin { pgfonlayer} { foreground}
2025-09-28 16:12:24 +02:00
\node [hlabelbox, below=13.32 of traindata] (newdatasample) { \boxtitle { New Data Sample} Same data type as training data} ;
2025-08-13 15:04:44 +02:00
\end { pgfonlayer}
\begin { pgfonlayer} { background}
\node [databox, fit=(newdatasample), label={[label distance = 1] above:{ \textbf { Unseen Data} } } ] (newdata) { } ;
\end { pgfonlayer}
\draw [arrow] (maintrain.south) -- (inferencelab.north);
\draw [arrow] (newdata.east) -- (inference.west);
\end { tikzpicture}
\end { document}