\section{Experiments}

	% intro
	
	All optimizations and evaluations took place within two adjacent buildings (4 and 2 floors, respectively)
	and two connected outdoor regions (entrance and inner courtyard),
	\SI{110}{\meter} x \SI{60}{\meter} in size.
	
	Within all \docWIFI{} observations we only consider the \docAP{}s that are permanently installed,
	and can be identified by their well-known MAC address.
	Temporal and movable transmitters like smart TVs or smartphone hotspots are ignored as they might cause estimation errors.
	%
	Unfortunately, due to non-disclosure agreements, we are not allowed to depict the actual location
	of installed transmitters within the following figures. 
	
	
	%modell direkt fuer den gelaufenen pfad optimiert (also wirklich jede wifi messung direkt auf den ground-truth)
	%der fehler wird zwar kleiner, ist aber immernoch deutlich spürbar. das spricht dafür, dass das modell einfach nicht
	%gut geeignet ist.

	%optimierungs input: alle 4 walks samt ground-truth
	%dann kommt fuer die 4 typen [fixed, all same par, each par, each par pos]
	%log probability 50 75,	meter 50, 75



	% -------------------------------- optimization -------------------------------- %
	
	\subsection{Model optimization}
	
		As the signal strength prediction model is the core of the absolute positioning component 
		described in section \ref{sec:system}, we start with the model parameter estimation (see \ref{sec:optimization}) for
		\mTXP{}, \mPLE{} and \mWAF{} based on some reference measurements and compare the results 
		between various optimization strategies and a basic empiric choice of \mTXP{} = \SI{-40}{\decibel{}m} @ \SI{1}{\meter}
		(defined by the usual \docAPshort{} transmit power for europe), a path loss exponent $\mPLE{} \approx $ \SI{2.5} and
		$\mWAF{} \approx$ \SI{-8}{\decibel} per floor / ceiling (made of reinforced concrete)  \todo{cite für werte}.
		
		Figure \ref{fig:referenceMeasurements} depicts the location of the used 121 reference measurements.
		Each location was scanned 30 times ($\approx$ \SI{25}{\second} scan time),
		non permanent \docAP{}s were removed, the values were grouped per physical transmitter (see \ref{sec:vap})
		and aggregated to form the average signal strength per transmitter.
		
		\begin{figure}
			\begin{subfigure}[t!]{0.48\textwidth}
				\input{gfx2/all_fingerprints.tex}
				\caption{
					The size of each square denotes the number of permanently installed \docAPshort{}s
					that were visible while scanning, and ranges between 2 and 22 with an average of 9.
				}
				\label{fig:referenceMeasurements}
			\end{subfigure}
			\enskip\enskip
			\begin{subfigure}[t!]{0.48\textwidth}
				\input{gfx2/model-bboxes.tex}
				\caption{
					More than one bounding box is needed for each model to approximate the building's shape.
					Each distinct floor-color denotes a single model (7 in total).
				}
				\label{fig:modelBBoxes}
			\end{subfigure}
			\caption{Locations of the 121 reference measurements (left) and bounding-boxes used for {\em \optPerRegion{}} (right).}
		\end{figure}
		
		% used reference measurements 
		%\begin{figure}
		%	{
		%		\centering
		%		\input{gfx/all_fingerprints.tex}
		%	}
		%	\caption{
		%		Locations of the 121 reference measurements.
		%		The size of each square denotes the number of permanently installed \docAPshort{}s
		%		that are visible at this location,
		%		and ranges between 2 and 22 with an average of 9.
		%	}
		%	\label{fig:referenceMeasurements}
		%\end{figure}
	
		% visible APs:
		% cnt(121)	min(2.000000)	max(22.000000)	range(20.000000)	med(8.000000)	avg(9.322314)	stdDev(4.386709)

		\begin{figure}
			\centering
			\input{gfx/compare-wifi-in-out.tex}
			\caption{
				Measurable signal strengths of a testing \docAPshort{} (black dot).
				While the signal diminishes slowly along the corridor (upper rectangle)
				the metallised windows (dashed outline) attenuate the signal by over \SI{30}{\decibel} (lower rectangle).
			}
			\label{fig:wifiIndoorOutdoor}
		\end{figure}
		
		Figure \ref{fig:wifiIndoorOutdoor} depicts the to-be-expected issues by examining the signal strength 
		values of the reference measurements for one \docAP{}. 
		Even though the transmitter is only \SI{5}{\meter} away from the reference
		measurement (small box), the metallised windows attenuate the signal as much as \SI{50}{\meter}
		of corridor (wide box). The model described in section \ref{sec:sigStrengthModel} will not be able
		to match such situations, due to the lack of obstacle information.
		%
		We will thus look at various optimization strategies and the error between
		the resulting estimation model and our reference measurements:
		
		{\em\noOptEmpiric{}} uses the same three empiric parameters \mTXP{}, \mPLE{}, \mWAF{} for each \docAPshort{} in combination
		with its position, which is well known from the floorplan.
		
		{\em\optParamsAllAP{}} is the same as above, except that the three parameters are optimized 
		using the reference measurements. However, all transmitters share the same three parameters.
		
		{\em\optParamsEachAP{}} optimizes the three parameters per \docAP{} instead of using the same
		parameters for all.
		
		{\em\optParamsPosEachAP{}} does not need any prior knowledge and will optimize all six parameters
		(3D position, \mTXP, \mPLE, \mWAF) based on the reference measurements.
		
		{\em\optPerFloor{}} and {\em\optPerRegion{}} are just like {\em \optParamsPosEachAP{}} except that
		there are several sub-models, each of which is optimized for one floor / region instead of the whole building.
		The chosen bounding boxes and resulting sub-models are depicted in figure \ref{fig:modelBBoxes}.

		Figure \ref{fig:wifiModelError} shows the optimization results for all strategies, which are as expected:
		The estimation error is indirectly proportional to the number of optimized parameters.
		However, even with {\em \optPerRegion{}} the maximal error is relatively high due to some locations that do
		not fit the model at all, which is shown in figure \ref{fig:wifiModelErrorB}.
		%
		Looking at the optimization results for \mTXP{}, \mPLE{} and \mWAF{} supports
		this finding. While the median for those values based on all optimized transmitters is totally sane
		(\SI{-42}{\decibel{}m}, \SI{2.4}, \SI{-6.0}{\decibel}), the minimum and maximum values are far beyond the physically possible range.
		
		The same holds for the estimated transmitter position when using {\em \optParamsPosEachAP{}}: The median
		distance between estimated and real position is $\sim$\SI{8}{\meter} and the maximum $\sim$\SI{27}{\meter}.
		For \SI{68}{\percent} of all installed transmitters, the estimated floor-number matched the real location.
		
		\begin{figure}
			\begin{subfigure}{0.52\textwidth}
				\input{gfx2/wifi_model_error_0_95.tex}
			\end{subfigure}
			\begin{subfigure}{0.23\textwidth}
				\input{gfx/wifiMaxErrorNN_opt0.tex}
				\caption{\em \noOptEmpiric{}}
				\label{fig:wifiModelErrorA}
			\end{subfigure}
			%\begin{subfigure}{0.25\textwidth}
			%	\input{gfx/wifiMaxErrorNN_opt3.tex}
			%\end{subfigure}
			\begin{subfigure}{0.23\textwidth}
				\input{gfx/wifiMaxErrorNN_opt5.tex}
				\caption{\em \optPerRegion{}}
				\label{fig:wifiModelErrorB}
			\end{subfigure}
			\caption{
				Comparison between different optimization strategies by examining the error (in \decibel) at each reference measurement.
				The higher the number of variable parameters, the better the model resembles real world conditions.
				Both figures on the right depict the highest error for each reference measurement, where full red means $\ge$ \SI{20}{\decibel}.
			}
			\label{fig:wifiModelError}
		\end{figure}
		

			
		%\begin{figure}
		%	\input{gfx/wifi_model_error_0_95.tex}
		%	%\input{gfx/wifi_model_error_95_100.tex}
		%	\caption{
		%		Comparison between different optimization strategies by examining the error (in \decibel) at each reference measurement.
		%		The higher the number of variable parameters, the better the model resembles real world conditions.
		%	}
		%	\label{fig:wifiModelError}
		%\end{figure}
		
		% statds:
		%TXP:	cnt(34)	min(-67.698959)	max(4.299183)	range(71.998146)	med(-41.961170)	avg(-41.659286)	stdDev(17.742294)	
		%EXP:	cnt(34)	min(0.932817)	max(4.699000)	range(3.766183)	med(2.380410)	avg(2.546959)	stdDev(1.074687)	
		%WAF:	cnt(34)	min(-27.764957)	max(5.217187)	range(32.982143)	med(-5.921916)	avg(-7.579522)	stdDev(5.840527)	
		%Pos:	cnt(34)	min(3.032438)	max(26.767128)	range(23.734690)	med(7.342710)	avg(8.571227)	stdDev(4.801449)	
	
		While {\em \optPerRegion{}} is able to overcome the indoor vs. outdoor issues depicted in 
		figure \ref{fig:wifiIndoorOutdoor}, by using a separate bounding box just for the outdoor area,
		it obviously requires a profound prior knowledge to correctly select the individual regions for the sub-model.
		%Such issues can only be fixed using more appropriate models that consider walls and other obstacles.
		
		% das ist wohl zu viel
		%\begin{figure}
		%	\centering
		%	\input{gfx/wifiOptApPosDifference.tex}
		%	\caption{zu viel, oder?}
		%\end{figure}
		

	% -------------------------------- number of fingerprints -------------------------------- %
	
		\hspace{3mm} % HACK...
	
		As we try to minimize the system's setup time as much as possible, we need to determine
		the amount of necessary reference measurements for the optimization to produce robust model parameters.
		Depending on the chosen model, and thus the number of to-be-optimized parameters, more measurements will be required.
		
		While there was almost no difference between using 121 or 30 reference measurements for 
		{\em \optParamsAllAP{}} and {\em \optParamsEachAP{}}
		(average error changed from \SIrange{5.3}{5.4}{\decibel} and \SIrange{4.5}{5.0}{\decibel}, respectively), 
		{\em \optPerRegion{}} is highly affected
		(average error changed from \SIrange{2.0}{6.2}{\decibel}), as it needs at least a certain number of measurements within each
		region for the optimization to converge.
		
		\begin{figure}
			\begin{subfigure}{0.49\textwidth}
				\input{gfx2/wifi_model_error_num_fingerprints_method_5_0_90.tex}
			\end{subfigure}
			\begin{subfigure}{0.49\textwidth}
				\input{gfx2/wifi_model_error_num_fingerprints_method_5_90_100.tex}
			\end{subfigure}
			\caption{
				Impact of reducing the number of reference measurements for optimizing {\em \optPerRegion{}}.
				The cumulative error distribution is determined by comparing its signal strength prediction against all 121 measurements.
				While using only \SI{50}{\percent} of the 121 scans has barely an impact on the error,
				30 measurements (\SI{25}{\percent}) are clearly insufficient. 
			}
			\label{fig:wifiNumFingerprints}
		\end{figure}
			
		
		%\begin{figure}[b]
		%	\input{gfx/wifi_model_error_num_fingerprints_method_5_0_90.tex}
		%	\input{gfx/wifi_model_error_num_fingerprints_method_5_90_100.tex}
		%	\caption{%
		%		Impact of reducing the number of reference measurements during optimization on {\em \optPerRegion{}}.
		%		The model's cumulative error distribution is determined by comparing the its signal strength prediction against all 121 measurements.
		%		While using only \SI{50}{\percent} of the 121 scans has barely an impact on the error,
		%		30 measurements (\SI{25}{\percent}) are clearly insufficient. 
		%	}%
		%	\label{fig:wifiNumFingerprints}%
		%\end{figure}
		
		Figure \ref{fig:wifiNumFingerprints} depicts the impact of reducing the number of reference measurements
		during the optimization process for the {\em \optPerRegion{}} strategy.
		The error is determined by using the (absolute) difference between expected signal strength and
		the optimized model's corresponding prediction for all of the 121 reference measurements.		
		%
		Considering only 60 of the 121 scans (\SI{50}{\percent}) yields a slightly increasing model error but still provides good results.
		While using only \SI{25}{\percent} of the reference  measurements increases the error rapidly,
		for \SI{75}{\percent} of the 121 considered error-values, the estimation is still better than using just empiric values without optimization.
		
		%The extremely large outlier depicted in the right half of figure \ref{fig:wifiNumFingerprints} (red line) relates to one
		%sub-model with only one assigned reference measurement, where the optimized result is unable to predict values
		%for the rest of the sub-model's region. \todo{versteht man das?}
		
		Additionally we examined the impact of skipping reference measurements for difficult locations
		like staircases, surrounded by steel-enforced concrete. While this slightly decreases the
		estimation error for all other positions (hallway, etc) as expected, the error within the skipped locations is dramatically
		increasing (see right half of figure \ref{fig:wifiNumFingerprints}). It is thus highly recommended
		to also perform reference measurements for locations, that are expected to strongly deviate (signal strength)
		from their surroundings.
		


		%leaving out fingerprints for model 1
		%	 25%: cnt(1128)	min(0.007439)	max(27.804710)	range(27.797272)	med(4.404236)	avg(5.449720)	stdDev(4.470373)	
		%	 50%: cnt(1128)	min(0.006027)	max(27.732193)	range(27.726166)	med(4.367859)	avg(5.437861)	stdDev(4.475426)	
		%	 100%: cnt(1128)	min(0.000282)	max(27.705376)	range(27.705093)	med(4.272881)	avg(5.411202)	stdDev(4.493495)	
		%	 noStair%: cnt(1128)	min(0.000801)	max(27.209221)	range(27.208420)	med(4.333328)	avg(5.459918)	stdDev(4.459484)	

		%leaving out fingerprints for model 2
		%	 25%: cnt(1128)	min(0.000320)	max(29.752560)	range(29.752239)	med(3.837357)	avg(5.027578)	stdDev(4.617191)	
		%	 50%: cnt(1128)	min(0.015305)	max(34.152130)	range(34.136826)	med(3.627090)	avg(4.635868)	stdDev(4.135866)	
		%	 100%: cnt(1128)	min(0.000488)	max(25.687740)	range(25.687252)	med(3.319756)	avg(4.441193)	stdDev(3.912525)	
		%	 noStair%: cnt(1128)	min(0.017693)	max(25.687740)	range(25.670048)	med(3.304321)	avg(4.507620)	stdDev(3.957071)	

		%leaving out fingerprints for model 3
		%	 25%: cnt(1128)	min(0.003242)	max(39.470978)	range(39.467735)	med(3.371758)	avg(4.977330)	stdDev(5.213937)	
		%	 50%: cnt(1128)	min(0.002808)	max(30.113415)	range(30.110607)	med(2.941238)	avg(4.015042)	stdDev(3.696969)	
		%	 100%: cnt(1128)	min(0.000557)	max(16.813850)	range(16.813293)	med(3.056915)	avg(3.813013)	stdDev(3.062580)	
		%	 noStair%: cnt(1128)	min(0.002518)	max(30.370636)	range(30.368118)	med(3.016884)	avg(3.983101)	stdDev(3.508327)	

		%leaving out fingerprints for model 4
		%	 25%: cnt(1128)	min(0.000000)	max(62.233345)	range(62.233345)	med(2.502831)	avg(5.432897)	stdDev(8.664582)	
		%	 50%: cnt(1128)	min(0.000000)	max(56.843803)	range(56.843803)	med(1.543137)	avg(2.937506)	stdDev(4.417061)	
		%	 100%: cnt(1128)	min(0.000046)	max(33.175812)	range(33.175766)	med(1.537933)	avg(2.441976)	stdDev(2.793499)	
		%	 noStair%: cnt(1128)	min(0.000000)	max(62.233345)	range(62.233345)	med(1.493668)	avg(2.744918)	stdDev(4.428092)	

		%leaving out fingerprints for model 5
		%	 25%: cnt(1128)	min(0.000000)	max(62.620842)	range(62.620842)	med(2.140709)	avg(6.257105)	stdDev(11.638572)	
		%	 50%: cnt(1128)	min(0.000000)	max(57.371948)	range(57.371948)	med(1.357452)	avg(2.982217)	stdDev(5.877471)	
		%	 100%: cnt(1128)	min(0.000000)	max(14.837151)	range(14.837151)	med(1.251358)	avg(1.989277)	stdDev(2.189072)	
		%	 noStair%: cnt(1128)	min(0.000000)	max(62.233345)	range(62.233345)	med(1.143669)	avg(2.316189)	stdDev(4.164822)	

		
		

	% -------------------------------- wifi walk error -------------------------------- %
	
	\subsection{Location estimation error}
	
		\todo{uebergang holprig?}
	
		%Using the optimized model setups and the measurements $\mRssiVec$ determined by scanning for nearby \docAPshort{}s,
		%we can directly perform a location estimation by rewriting \refeq{eq:wifiProb}:
		For each of the discussed optimization strategies we can now determine the resulting localization accuracy.
		The position within the building that best fits some signal strength measurements $\mRssiVec$ received by the smartphone
		is the one that maximizes $p(\mPosVec \mid \mRssiVec)$ and can be rewritten as:
		
		\begin{equation}
			p(\mPosVec \mid \mRssiVec) =
				\frac{p(\mRssiVec \mid \mPosVec) p(\mPosVec)}{p(\mRssiVec)}
			\propto p(\mRssiVec \mid \mPosVec),\enskip
			p(\mPosVec) = p(\mRssiVec) = \text{const}
			.
			\label{eq:wifiBayes}
		\end{equation}
		
		Following \refeq{eq:wifiObs} and \refeq{eq:wifiProb}, the best
		location $\mPosVec^*$ given $\mRssiVec$ is the one that satisfies
				
		\begin{equation}
			\mPosVec^* = \argmax_{\mPosVec} 
			\prod_{\mRssi_{i} \in \mRssiVec{}}
				\mathcal{N}(\mRssi_i \mid \mu_{i,\mPosVec}, \sigma^2)
			\label{eq:bestWiFiPos}
		\end{equation}
		
		where $\mu_{i,\mPosVec}$ is the signal strength for \docAP{} $i$
		at location $\mPosVec$ returned from the to-be-examined prediction model.
		For all comparisons we use a constant uncertainty $\sigma = \SI{8}{\decibel}$.
		
		The quality of the estimated location is determined by using the Euclidean distance between estimation 
		$\mPosVec^*$ and the pedestrian's ground truth position at the time the scan $\mRssiVec$
		has been received.
		
		
		
		We therefore conducted 13 walks on 5 different paths within our building,
		each of which is defined by connecting marker points at well known positions
		(see figure \ref{fig:allWalks}).
		Whenever the pedestrian reached such a marker, the current time was recorded.
		Due to constant walking speeds, the ground-truth for any timestamp can be approximated
		using linear interpolation between adjacent markers.
	
		% walked paths
		\begin{figure}
			\centering
			\input{gfx/all_walks.tex}
			\caption{
				Overview of all conducted paths.
				Outdoor areas are marked in green.
			}
			\label{fig:allWalks}
		\end{figure}
		
		\begin{figure}
			\input{gfx/modelPerformance_meter.tex}
			\caption{
				Cumulative error distribution between ground truth and location estimation using \refeq{eq:bestWiFiPos} depending
				on the underlying signal strength prediction model.
				Extremely high errors between the \SIrange{90}{100}{\percent} quartile are related to bad \docWIFI{}
				coverage within outdoor areas (see figure \ref{fig:wifiIndoorOutdoor}).
			}
			\label{fig:modelPerformance}
		\end{figure}
		
		%To estimate the overall performance of the prediction models, we compare the position estimation
		%for each \docWIFI{} measurement within the recorded paths (3756 \docAPshort{} scans in total)
		%against the corresponding ground-truth, which indicates the absolute 3D error in meter. 
		The position estimation for each \docWIFI{} measurement within the recorded walks (3756 scans in total)
		is compared against its corresponding ground-truth, indicating the 3D distance error.
		The resulting cumulative error distribution can be seen in figure \ref{fig:modelPerformance}.
		The quality of the location estimation directly scales with the quality of the signal strength prediction model.
		However, as discussed earlier, the maximal estimation error might increase for some setups.
		%
		This is either due to multimodalities, where more than one area is possible based on the recent
		\docWIFI{} observation, or optimization yielded an overadaption where the average signal
		strength prediction error is small, but the maximum error is dramatically increased for some regions.
				
			
	
	% -------------------------------- plots indicating walk issues -------------------------------- %
		
		\begin{figure}
			\input{gfx/wifiMultimodality.tex}
			\caption{
				Location probability \refeq{eq:bestWiFiPos} for three scans. Higher color intensities are more likely.
				Ideally, places near the black ground truth are highly highly probable (green).
				Often, other locations are just as likely as the ground truth (blue),
				or the location with the highest probability does not match at all (red).
			}
			\label{fig:wifiMultimodality}
		\end{figure}
		
		Figure \ref{fig:wifiMultimodality} depicts aforementioned issues of multimodal (blue) or wrong (red) location 
		estimations. Filtering (\refeq{eq:recursiveDensity}) thus is highly recommended, as minor errors are compensated
		using other sensors or a movement model that prevents the estimation from leaping within the building.
		However, if wrong sensor values are observed for longer time periods, even filtering will produce erroneous 
		results and might get stranded (density is trapped e.g. within a room),
		as the movement model is constrained by the actual floorplan.


	% -------------------------------- other distributions, unseen APs, etc -------------------------------- %
		
		\hspace{3mm}%hack
		
		To reduce the amount such of misclassifications, where other locations within the building are 
		as likely as the pedestrian's actual location, we examined various approaches.
		Unfortunately, most of which did not provide a viable enhancement under all conditions for the performed walks.
		
		The misclassification-rate is determined by counting the amount of (random) locations within
		the building that produce a similar probability \refeq{eq:wifiProb} as the actual ground-truth
		position.
		
		One possibility to dissolve such an equal \docWIFI{}-likelihood between two (or more) locations is,
		to not only consider the \docAPshort{}s seen by the smartphone, but also the \docAPshort{}s not seen
		by the smartphone. This additional information can be used to rule out all locations where this unseen
		\docAP{} should have be received (high signal strength from the prediction model).
		% There might be an \docAP{} that should be visible at the other locations. However,
		%as the Smartphone did not see this \docAPshort{} the other location can be ruled out.
		While this works in theory, evaluations revealed several issues:
		
		There is a chance that even a nearby \docAPshort{} is unseen during a scan due to packet collisions or
		temporal effects within the surrounding. It thus might make sense to opt-out other locations
		only, if at least two \docAPshort{}s are missing. On the other hand, this obviously demands for (at least)
		two \docAPshort{}s to actually be different between the two locations, and requires a lot of permanently 
		installed transmitters to work out.
		
		Furthermore, this requires the signal strength prediction model to be fairly accurate. Within our testing 
		walks, several places are surrounded by concrete walls, which cause a harsh, local drop in signal strength.
		The models used within this work will not accurately predict the signal strength for such locations.
		%%Including \docAPshort{}s unseen by the Smartphone thus often increases the estimation error instead
		%%of fixing the multimodality.
				
		To sum up, while some situations, e.g. outdoors, could be improved, 
		many other situations are deteriorated, especially when some transmitters are (temporarily)
		attenuated by ambient conditions like concrete walls.
				
		
		We therefore examined variations of the probability calculation from \refeq{eq:wifiProb}.
		Despite the results show in \cite{PotentialRisks}, removing weak \docAPshort{}s from $\mRssiVec{}$
		yielded similar results. While some estimations were improved, the overall error increased
		for our walks, as there are many situations where only a handful \docAP{}s can be seen.
		Removing this (valid) information will highly increase the error for such situations.
		
		Incorporating additional knowledge provided by virtual \docAP{}s (see section \ref{sec:vap}) mitigated this issues.
		If only one out of six virtual networks is observed, this observation is likely to be erroneous, no matter
		what the corresponding signal strength indicates. This approach improved the location estimation especially
		for areas where a transmitter was hardly seen within the reference measurements and its optimization is thus
		expected to be inaccurate.		
		
		Using a smaller $\sigma$ or a more strict exponential distribution for the model vs. scan comparison in \refeq{eq:wifiProb}
		had a positive effect on the misclassification error for some of the walks, but also slightly increased the overall estimation error.
		%(see figure \ref{fig:normalVsExponential}).
		Due to those negative side-effects, the final localization system (\refeq{eq:recursiveDensity}) is unlikely to profit from such changes.
		
		\todo{ueberleitung OK?}
		
		% braucht zu viel platz
		%\begin{figure}
		%	\input{gfx/wifiCompare_normalVsExp_cross.tex}
		%	\input{gfx/wifiCompare_normalVsExp_meter.tex}
		%	\caption{
		%		Comparison between normal- (black) and exponential-distribution (red) for \refeq{eq:wifiProb}.
		%		While misclassifications are slightly reduced (upper chart),
		%		the median error between ground-truth and estimation (lower chart) increases by
		%		about \SI{1}{\meter}.		 		
		%	}
		%	\label{fig:normalVsExponential}
		%\end{figure}
		


	%\todo{
	%	erwähnen??? sigma je nach signalstärke anpassen bringt leider auch nichts. wenn man das aber macht,
	%	dann: fuer grosse signalstaerken ein grosses sigma! andersrum gehts nach hinten los!
	%}




	% -------------------------------- final system -------------------------------- %

	\subsection{Overall system error}

		After examining the \docWIFI{} component on its own, we will now analyze the impact of aforementioned model
		optimizations on our smartphone-based indoor localization system described in section \ref{sec:system}.
		
		Due to transition constraints from the buildings floorplan, we expect the 
		posterior density to often get stuck when the \docWIFI{} component provides erroneous estimations
		due to bad signal strength predictions:
		%
		A pedestrian walks along a hallway, but bad model values indicate that his most likely position
		is within a room right next to the hallway.
		If the density (described by the particles) is dragged (completely) into this room, 
		the IMU indicates no change in direction (pedestrian walks straight),
		and the room has only one single door, the density is trapped within this room.
		%
		While such problems can often be solved by simply using more particles to describe the posterior,
		smartphone use-cases are usually performance- and battery limited.
		
		As particle filtering from \refeq{eq:recursiveDensity} is a random process with varying output,
		we calculated each combination of the {\em 13 walks and six optimization strategies},
		25 times, using 5000, 7500 and 10000 particles resulting in 75 runs per walk, 975 per strategy and 5850 in total.
		%
		Figure \ref{fig:overallSystemError} depicts the cumulative error distribution per optimization strategy,
		resulting from all executions for each walk conducted with the smartphone.
		
		While most values represent the expected results (more optimization yields better results),
		the values for {\em \noOptEmpiric{}} and {\em \optPerRegion{}} do not.
		The slightly increased error for both strategies can be explained by having a closer look at the walked
		paths and relates to exceptional regions like outdoors. In both cases there is some sort of model overadaption.
		%
		As mentioned earlier, {\em \noOptEmpiric{}} is unable to accurately model the signal strength for the whole
		building, resulting in increased estimation errors for outdoor regions, where the filter fails to conclude
		the walk.
		%
		While {\em \optPerRegion{}} does not suffer from such issues due to separated optimization regions for in- and outdoor,
		its increased error relates to movements between such adjacent regions, as there often is a huge model difference.
		While this difference is perfectly fine, as it also exists within real world conditions,
		the filtering process suffers especially at such model-boundaries:
		The model prevents the particles from moving e.g. from inside the building towards outdoor regions, as the 
		outdoor-model does not match at all. Due to sensor delays and issues with the absolute heading near in- and outdoor boundaries
		(metal-framed doors) the error is slightly increased and retained for some time until the density stabilizes itself.
		
		Such situations should be mitigated by the smartphone's GPS sensor. However, within our testing walks, the GPS
		did rarely provide accurate measurements, as the outdoor-time was too short for the sensor to receive a valid
		fix and the accuracy indicated by the GPS usually was \SI{50}{\meter} and above.
		
		Especially for {\em path 1}, the particle-filter often got stuck within the upper right outdoor area between both buildings
		(see figure \ref{fig:allWalks}). Using the empirical parameters, \SI{40}{\percent} of all runs for this path got stuck at this location.
		{\em \optParamsAllAP{}} already reduced the risk to \SI{20}{\percent} and all other optimization strategies did not get stuck at all.
		
		The same effect holds for all other conducted walks: The better the model optimization, the lower the risk of getting stuck somewhere along the path.
		
		Varying the number of particles between 5000 and 10000 indicated only a minor increase in accuracy and slightly decreased the risk of getting stuck.
		
		Comparing the error results within figure \ref{fig:modelPerformance} and \ref{fig:overallSystemError}, one can
		denote the positive impact of fusioning multiple sensors with a transition model based on the building's
		actual floorplan. Outdoor regions indicated a very low signal quality (see section \ref{sec:wifiQuality}).
		By omitting \docWIFI{} from the system's evaluation step, the IMU was able to
		keep the pedestrian's current heading until the signal quality reached sane levels again.
		
		
		\begin{figure}
			\input{gfx/overall-system-error.tex}
			\caption{
				Cumulative error distribution for each model when used within the final localization system from \refeq{eq:recursiveDensity}.
				Despite some discussed exceptions, highly optimized models lead to lower localization errors. 
			}
			\label{fig:overallSystemError}
		\end{figure}

	% results
%	5000 particles
%
%		model empiric
%		|path1a(5.76715@100%)	|path1b(3.73881@4%)	|toni-all-1a(6.1505@76%)	|toni-all-1b(4.60639@40%)	|path2a(7.35355@28%)	|path2b(7.4316@0%)	|toni-all-2a(10.7068@44%)	|toni-all-2b(7.4323@28%)	|toni-inst-1b(4.60685@0%)	|toni-inst-2a(3.83979@0%)	|toni-inst-2b(3.98889@0%)	|toni-inst-3a(4.70925@0%)	|toni-inst-3b(4.40971@0%)	 | OVERALL:(5.12463@24%)
%		model opt 1
%		|path1a(17.6635@56%)	|path1b(9.41882@24%)|toni-all-1a(4.06972@0%)	|toni-all-1b(3.83157@0%)	|path2a(6.92405@16%)	|path2b(8.6365@16%)	|toni-all-2a(11.6348@48%)	|toni-all-2b(12.029@76%)	|toni-inst-1b(5.07535@0%)	|toni-inst-2a(4.45517@0%)	|toni-inst-2b(3.99025@0%)	|toni-inst-3a(8.28201@8%)	|toni-inst-3b(5.57021@20%)	 | OVERALL:(6.57212@20%)
%		model opt 2
%		|path1a(2.01602@0%)		|path1b(2.90237@0%)	|toni-all-1a(2.80293@0%)	|toni-all-1b(1.99745@0%)	|path2a(5.39013@4%)		|path2b(8.13855@0%)	|toni-all-2a(9.7462@40%)	|toni-all-2b(9.28677@44%)	|toni-inst-1b(4.5305@0%)	|toni-inst-2a(4.28726@0%)	|toni-inst-2b(4.03041@0%)	|toni-inst-3a(4.26278@4%)	|toni-inst-3b(5.63394@24%)	 | OVERALL:(4.07822@8%)
%		model opt 3
%		|path1a(1.74623@0%)		|path1b(2.61609@0%)	|toni-all-1a(2.49372@0%)	|toni-all-1b(1.90326@0%)	|path2a(5.07957@4%)		|path2b(7.73973@8%)	|toni-all-2a(10.2793@48%)	|toni-all-2b(6.48194@16%)	|toni-inst-1b(5.73752@4%)	|toni-inst-2a(3.76165@0%)	|toni-inst-2b(3.51509@0%)	|toni-inst-3a(6.06681@16%)	|toni-inst-3b(5.27748@24%)	 | OVERALL:(3.94786@9%)
%		model per floor
%		|path1a(1.76139@0%)		|path1b(2.22047@0%)	|toni-all-1a(2.10094@0%)	|toni-all-1b(1.62287@0%)	|path2a(5.50715@16%)	|path2b(7.1257@0%)	|toni-all-2a(10.5138@48%)	|toni-all-2b(6.72044@20%)	|toni-inst-1b(3.77885@0%)	|toni-inst-2a(2.23669@0%)	|toni-inst-2b(3.20604@0%)	|toni-inst-3a(2.46891@0%)	|toni-inst-3b(2.73366@0%)	 | OVERALL:(3.22315@6%)
%		model per bbox	
%		|path1a(1.80033@0%)		|path1b(2.32875@0%)	|toni-all-1a(2.17754@0%)	|toni-all-1b(1.6697@0%)		|path2a(6.38772@16%)	|path2b(5.84004@0%)	|toni-all-2a(9.67635@36%)	|toni-all-2b(8.3282@24%)	|toni-inst-1b(4.11891@0%)	|toni-inst-2a(2.64016@0%)	|toni-inst-2b(3.36297@0%)	|toni-inst-3a(2.15568@0%)	|toni-inst-3b(2.98047@0%)	 | OVERALL:(3.40679@5%)
%
%
%	7500 particles
%		model empiric
%		|path1a(8.23256@100%)	|path1b(3.91532@0%)	|toni-all-1a(7.0666@80%)	|toni-all-1b(5.35225@48%)	|path2a(6.5708@16%)		|path2b(7.53023@0%)	|toni-all-2a(10.6246@40%)	|toni-all-2b(6.63087@4%)	|toni-inst-1b(4.76934@0%)	|toni-inst-2a(3.82903@0%)	|toni-inst-2b(4.00339@0%)	|toni-inst-3a(3.85417@4%)	|toni-inst-3b(4.47613@0%)	 | OVERALL:(5.23337@22%)
%		model opt 1
%		|path1a(10.3959@36%)	|path1b(8.37674@16%)|toni-all-1a(3.96164@0%)	|toni-all-1b(4.24675@4%)	|path2a(6.02912@8%)		|path2b(8.1804@0%)	|toni-all-2a(12.4277@48%)	|toni-all-2b(10.4748@56%)	|toni-inst-1b(5.49874@4%)	|toni-inst-2a(4.09279@0%)	|toni-inst-2b(3.87762@0%)	|toni-inst-3a(5.10456@0%)	|toni-inst-3b(4.52029@4%)	 | OVERALL:(5.97832@13%)
%		model opt 2
%		|path1a(2.04657@0%)		|path1b(2.82853@0%)	|toni-all-1a(2.93467@0%)	|toni-all-1b(1.98463@0%)	|path2a(4.66513@8%)		|path2b(8.19959@0%)	|toni-all-2a(8.34246@12%)	|toni-all-2b(7.2456@12%)	|toni-inst-1b(4.72651@0%)	|toni-inst-2a(4.00208@0%)	|toni-inst-2b(3.94811@0%)	|toni-inst-3a(3.74498@0%)	|toni-inst-3b(5.15519@16%)	 | OVERALL:(3.99594@3%)
%		model opt 3
%		|path1a(1.82148@0%)		|path1b(2.7664@0%)	|toni-all-1a(2.46073@0%)	|toni-all-1b(1.93273@0%)	|path2a(5.15394@4%)		|path2b(7.53562@0%)	|toni-all-2a(8.43582@20%)	|toni-all-2b(6.01557@8%)	|toni-inst-1b(5.47576@0%)	|toni-inst-2a(3.44451@0%)	|toni-inst-2b(3.6069@0%)	|toni-inst-3a(4.84921@4%)	|toni-inst-3b(5.62456@8%)	 | OVERALL:(3.88747@3%)
%		model per floor
%		|path1a(1.79881@0%)		|path1b(2.1456@0%)	|toni-all-1a(2.17125@0%)	|toni-all-1b(1.63247@0%)	|path2a(5.37789@8%)		|path2b(6.79701@0%)	|toni-all-2a(9.29407@32%)	|toni-all-2b(6.28292@8%)	|toni-inst-1b(3.79967@0%)	|toni-inst-2a(2.24007@0%)	|toni-inst-2b(3.15768@0%)	|toni-inst-3a(2.17671@0%)	|toni-inst-3b(2.83445@0%)	 | OVERALL:(3.16559@3%)
%		model per bbox
%		|path1a(1.77473@0%)		|path1b(2.2609@0%)	|toni-all-1a(2.06814@4%)	|toni-all-1b(1.6841@0%)		|path2a(6.48652@4%)		|path2b(5.79359@0%)	|toni-all-2a(9.40116@24%)	|toni-all-2b(7.21382@16%)	|toni-inst-1b(3.82829@0%)	|toni-inst-2a(2.47975@0%)	|toni-inst-2b(3.35265@0%)	|toni-inst-3a(2.20058@0%)	|toni-inst-3b(2.86407@0%)	 | OVERALL:(3.3381@3%)
%
%	10000 particles
%		model empiric
%		|path1a(6.43082@100%)	|path1b(3.58544@0%)	|toni-all-1a(6.92747@76%)	|toni-all-1b(5.81139@72%)	|path2a(5.12683@4%)		|path2b(7.91078@0%)	|toni-all-2a(10.3958@16%)	|toni-all-2b(7.09186@8%)	|toni-inst-1b(4.45815@0%)	|toni-inst-2a(4.077@0%)		|toni-inst-2b(4.02524@0%)	|toni-inst-3a(3.35953@0%)	|toni-inst-3b(4.40318@0%)	 | OVERALL:(5.06224@21%)
%		model opt 1
%		|path1a(6.47262@16%)	|path1b(6.04852@12%)|toni-all-1a(3.97276@0%)	|toni-all-1b(3.62778@0%)	|path2a(5.48776@8%)		|path2b(8.21965@0%)	|toni-all-2a(11.3175@44%)	|toni-all-2b(11.4499@60%)	|toni-inst-1b(5.19827@0%)	|toni-inst-2a(4.1351@0%)	|toni-inst-2b(3.90291@0%)	|toni-inst-3a(4.58096@8%)	|toni-inst-3b(4.62723@4%)	 | OVERALL:(5.47998@11%)
%		model opt 2
%		|path1a(2.15007@0%)		|path1b(2.80157@0%)	|toni-all-1a(2.70849@0%)	|toni-all-1b(1.8937@0%)		|path2a(4.13743@0%)		|path2b(8.20317@0%)	|toni-all-2a(7.86448@12%)	|toni-all-2b(7.41533@12%)	|toni-inst-1b(4.54459@0%)	|toni-inst-2a(4.17614@0%)	|toni-inst-2b(3.90311@0%)	|toni-inst-3a(3.846@4%)		|toni-inst-3b(4.84665@8%)	 | OVERALL:(3.89883@2%)
%		model opt 3
%		|path1a(1.79085@0%)		|path1b(2.64892@0%)	|toni-all-1a(2.33085@0%)	|toni-all-1b(1.9533@0%)		|path2a(4.40712@4%)		|path2b(7.815@0%)	|toni-all-2a(8.97738@28%)	|toni-all-2b(5.87188@0%)	|toni-inst-1b(4.93315@0%)	|toni-inst-2a(3.53349@0%)	|toni-inst-2b(3.60056@0%)	|toni-inst-3a(5.57379@8%)	|toni-inst-3b(4.49996@4%)	 | OVERALL:(3.78756@3%)
%		model per floor
%		|path1a(1.7498@0%)		|path1b(2.11555@0%)	|toni-all-1a(1.89388@0%)	|toni-all-1b(1.61323@0%)	|path2a(5.06884@0%)		|path2b(6.7157@0%)	|toni-all-2a(9.54228@36%)	|toni-all-2b(6.7699@24%)	|toni-inst-1b(3.84709@0%)	|toni-inst-2a(2.2789@0%)	|toni-inst-2b(3.17625@0%)	|toni-inst-3a(2.13417@0%)	|toni-inst-3b(2.59095@0%)	 | OVERALL:(3.08506@4%)
%		model per bbox
%		|path1a(1.73406@0%)		|path1b(2.30577@0%)	|toni-all-1a(2.01979@0%)	|toni-all-1b(1.64225@0%)	|path2a(6.30713@12%)	|path2b(6.02961@0%)	|toni-all-2a(9.70206@20%)	|toni-all-2b(6.55847@8%)	|toni-inst-1b(3.93324@0%)	|toni-inst-2a(2.459@0%)		|toni-inst-2b(3.3522@0%)	|toni-inst-3a(2.13783@0%)	|toni-inst-3b(2.63231@0%)	 | OVERALL:(3.29408@3%)

%	all combined
%		model empiric
%		|path1a(6.72661@100%)	|path1b(3.74113@1%)	|toni-all-1a(6.69696@77%)	|toni-all-1b(5.26661@53%)	|path2a(6.11286@16%)	|path2b(7.63154@0%)	|toni-all-2a(10.5765@33%)	|toni-all-2b(7.0506@13%)	|toni-inst-1b(4.61087@0%)	|toni-inst-2a(3.91375@0%)	|toni-inst-2b(4.00372@0%)	|toni-inst-3a(3.89586@1%)	|toni-inst-3b(4.43552@0%)	 | OVERALL:(5.13701@22%)
%		model opt 1
%		|path1a(10.0538@36%)	|path1b(7.96075@17%)|toni-all-1a(3.99762@0%)	|toni-all-1b(3.89137@1%)	|path2a(6.08714@10%)	|path2b(8.33165@5%)	|toni-all-2a(11.7481@46%)	|toni-all-2b(11.2068@64%)	|toni-inst-1b(5.25558@1%)	|toni-inst-2a(4.23255@0%)	|toni-inst-2b(3.92269@0%)	|toni-inst-3a(5.62327@5%)	|toni-inst-3b(4.82302@9%)	 | OVERALL:(6.00231@15%)
%		model opt 2
%		|path1a(2.07273@0%)		|path1b(2.84622@0%)	|toni-all-1a(2.81671@0%)	|toni-all-1b(1.9553@0%)		|path2a(4.66453@4%)		|path2b(8.17561@0%)	|toni-all-2a(8.60702@21%)	|toni-all-2b(7.68813@22%)	|toni-inst-1b(4.59132@0%)	|toni-inst-2a(4.15243@0%)	|toni-inst-2b(3.96315@0%)	|toni-inst-3a(3.96402@2%)	|toni-inst-3b(5.16219@16%)	 | OVERALL:(3.99259@5%)
%		model opt 3
%		|path1a(1.78819@0%)		|path1b(2.67775@0%)	|toni-all-1a(2.43527@0%)	|toni-all-1b(1.92948@0%)	|path2a(4.90009@4%)		|path2b(7.70505@2%)	|toni-all-2a(9.16313@32%)	|toni-all-2b(6.10436@8%)	|toni-inst-1b(5.37191@1%)	|toni-inst-2a(3.57332@0%)	|toni-inst-2b(3.57426@0%)	|toni-inst-3a(5.4337@9%)	|toni-inst-3b(5.12685@12%)	 | OVERALL:(3.86918@5%)
%		model per floor
%		|path1a(1.77029@0%)		|path1b(2.16265@0%)	|toni-all-1a(2.05043@0%)	|toni-all-1b(1.62289@0%)	|path2a(5.29536@8%)		|path2b(6.88344@0%)	|toni-all-2a(9.75416@38%)	|toni-all-2b(6.57473@17%)	|toni-inst-1b(3.80742@0%)	|toni-inst-2a(2.25183@0%)	|toni-inst-2b(3.18067@0%)	|toni-inst-3a(2.24992@0%)	|toni-inst-3b(2.72835@0%)	 | OVERALL:(3.15739@4%)
%		model per bbox
%		|path1a(1.76908@0%)		|path1b(2.30081@0%)	|toni-all-1a(2.09503@1%)	|toni-all-1b(1.66411@0%)	|path2a(6.39346@10%)	|path2b(5.8772@0%)	|toni-all-2a(9.59953@26%)	|toni-all-2b(7.06924@16%)	|toni-inst-1b(3.96094@0%)	|toni-inst-2a(2.51694@0%)	|toni-inst-2b(3.3549@0%)	|toni-inst-3a(2.1656@0%)	|toni-inst-3b(2.81547@0%)	 | OVERALL:(3.34847@4%)


	% REAL WALKS
	
		%\todo{obwohl das angepasste modell doch recht gut laeuft und der fehler recht klein wird, sind immernoch stellen dabei,
		%wo es einfach nicht gut passt, unguenstige mehrdeutigkeiten vorliegen, oder regionen einfach nicht passen wie sie sollten.
		%das liegt teils auch daran, dass die fingerprints drehend aufgenommen wurden und beim laufen nach hinten durch den
		%menschen abgeschottet wird. auch zeitlicher verzug kann ein problem darstellen.}
		
		%\todo{
		%	wenn ich beim fingerprinten einen AP an einer stelle NICHT gesehen habe,
		%	ist das auch eine aussage für die model optimierung.. da kann dann sicher keine signatlstaerke > -90 an der stelle raus kommen
		%}
		

		%ware das grid-model nicht da, wuerde der outdoor teil richtig schlecht laufen,
		%weil das wlan hier absolut ungenau ist.. da die partikel aber aufgrund des vorherigen
		%walks schon recht dicht beisamen sind, kittet das das ganze sehr gut.
		%kann man testen, indem man z.B. weniger resampling macht und mehr alte partikel aufhebt.
		%geht sofort kaputt sobald man aus dem gebäude raus kommt



		% was ist das??
		%\input{gfx/wifi-opt-error-hist-methods.tex}
		%\input{gfx/wifi-opt-error-hist-stair-outdoor.tex}
		%outdoor hat insgesamt nicht all zu viel einfluss, da die meisten APs
		%an den outdoor punkten kaum gesehen werden. auf einzelne APs kann
		%der einfluss jedoch recht groß sein, siehe den fingerprint plot von
		%dem einen ausgewählten AP


	%\todo{anfaenglich falsches heading ist gift, wegen rel. heading, weil sich dann alles verlaeuft. fix: anfaenglich große heading variation erlauben}

	%\todo{NICHT MEHR AKTUELL: abs-head ist in der observation besser, weil es beim resampling mehr bringt und dafuer srogt, dass die richtigen geloescht werden!}

