# Modeling a Sensor to Improve Its Efficacy

Authors: Nabin K. Malakar; Daniil Gladkov; Kevin H. Knuth
Journal: Journal of Sensors
 (2013)

---

## Abstract

Robots rely on sensors to provide them with information about their surroundings. However, high-quality sensors can be extremely expensive and cost-prohibitive. Thus many robotic systems must make due with lower-quality sensors. Here we demonstrate via a case study how modeling a sensor can improve its efficacy when employed within a Bayesian inferential framework. As a test bed we employ a robotic arm that is designed to autonomously take its own measurements using an inexpensive LEGO light sensor to estimate the position and radius of a white circle on a black field. The light sensor integrates the light arriving from a spatially distributed region within its field of view weighted by its spatial sensitivity function (SSF). We demonstrate that by incorporating an accurate model of the light sensor SSF into the likelihood function of a Bayesian inference engine, an autonomous system can make improved inferences about its surroundings. The method presented here is data based, fairly general, and made with plug-and-play in mind so that it could be implemented in similar problems.


---

## Body

## 1. Introduction

Robots rely on sensors to provide them with information about their surroundings. However, high-quality sensors can be cost-prohibitive and often one must make due with lower quality sensors. In this paper we present a case study which demonstrates how employing an accurate model of a sensor within a Bayesian inferential framework can improve the quality of inferences made from the data produced by that sensor. In fact, the quality of the sensor can be quite poor, but if it is known precisely how it is poor, this information can be used to improve the results of inferences made from the sensor data.To accomplish this we rely on a Bayesian inferential framework where a machine learning system considers a set of hypotheses about its surroundings and identifies more probable hypotheses given incoming sensor data. Such inferences rely on a likelihood function, which quantifies the probability that a hypothesized situation could have given rise to the data. The likelihood is often considered to represent the noise model, and this inherently includes a model of how the sensor is expected to behave when presented with a given stimulus. By incorporating an accurate model of the sensor, the inferences made by the system are improved.As a test bed we employ an autonomous robotic arm developed in the Knuth Cyberphysics Laboratory at the University at Albany (SUNY). The robot is designed to perform studies in autonomous experimental design [1, 2]. In particular it performs autonomous experiments where it uses an inexpensive LEGO light sensor to estimate the position and radius of a white circle on a black field. The light sensor integrates the light arriving from a spatially distributed region within its field of view weighted by its spatial sensitivity function (SSF). We consider two models of the light sensor. The naïve model predicts that the light sensor will return one value on average if it is centered over a black region and another higher value on average if it is centered on a white region. The more accurate model incorporates information about the SSF of the light sensor to predict what values the sensor would return given a hypothesized surface albedo field. We demonstrate that by incorporating a more accurate model of the light sensor into the likelihood function of a Bayesian inference engine, a robot can make improved inferences about its surroundings. The efficacy of the sensor model is quantified by the average number of measurements the robot needs to make to estimate the circle parameters within a given precision.There are two aspects to this work. First is the characterization of the light sensor and second is the incorporation of the light sensor model into the likelihood function of the robot’s machine learning system in a demonstration of improved efficacy. In Section2 we describe the robot, its light sensor, the experiment that it is designed to perform, and the machine learning system employed. We then discuss the methods used to collect data from the light sensor, the models used to describe the light sensor, their incorporation into the machine learning system, and the methods used to estimate the model parameters and select the model order. Section 3 describes the resulting SSF model and the results of the experiments comparing the naïve light sensor model to the more accurate SSF model. In Section 4 we summarize our results which demonstrate how, by incorporating a more accurate model of sensor, one can improve its efficacy.


## 2. Materials and Methods

In this section we begin by discussing various aspects of the robotic test bed followed by a discussion of the techniques used to characterize the light sensor.


### 2.1. Robotic Arm Test Bed

The robotic arm is designed to perform studies in autonomous experimental design [1, 2]. The robot itself is constructed using the LEGO NXT Mindstorms system (Figure 1). The LEGO Mindstorms system was utilized in part to demonstrate that high-quality autonomous systems can be achieved when using lower quality equipment if the machine learning and data analysis algorithms are handled carefully. It employs one motor to allow it to rotate about a vertical axis indicated by the black line in the top center of the figure and two motors to extend and lower the arm about the joints located at the positions indicated by the short arrows. The motors are controlled directly by the LEGO brick, which is commanded via Bluetooth by a Dell Latitude laptop computer running the robot’s machine learning system, which is programmed in MatLab (Mathworks, Inc.). The LEGO light sensor is attached to the end of the arm (indicated by the long arrow in Figure 1 and displayed in the inset at the upper right). Based on commands issued by the laptop, the robotic arm can deploy the light sensor to any position within its reach on the playing field. The light sensor is lowered to an average height of 14 mm above the surface before taking a measurement. The arm is designed using a trapezoidal construction that maintains the sensor’s orientation to be aimed at nadir, always normal to the surface, despite the extension of the arm.Figure 1
A photograph showing the robotic arm along with the circle it is programmed to characterize. The robotic arm is constructed using the LEGO NXT Mindstorms System. It employs one motor to allow it to rotate about a vertical axis indicated by the black line in the top center of the image and two motors to extend and lower the arm about the joints located at the positions indicated by the short arrows. The LEGO light sensor, also shown in the inset, is attached to the end of the arm as indicated by the long arrow.The LEGO light sensor (LEGO Part 9844) consists of a photodiode-LED pair. The white circle is the photo diode, and the red circle is the illuminating LED. Note that they are separated by a narrow plastic ridge, which prevents the LED from shining directly into the photo diode. This ridge, along with the plastic lenses and the presence of the illuminating LED, affects the spatial sensitivity of the sensor. When activated, the light sensor flashes for a brief instant and measures the intensity of the reflected light. The photo diode and its support circuitry are connected to the sensor port of the LEGO Brick (LEGO Part 9841), which runs on a 32 bit ARM7 ATMEL microcontroller. The measured intensities are converted by internal software running on the ATMEL microcontroller to a scale of 1 to 100, which we refer to asLEGO units. The light sensor integrates the light arriving from a spatially distributed region within its field of view. The spatial sensitivity of the sensor to light sources within its field of view is described by the spatial sensitivity function (SSF). This function is unknown, but if it were known, one could weight the surface albedo field with the SSF and integrate to obtain an estimate of the recorded intensity of the reflected light.


### 2.2. The Circle Characterization Experiment

The robotic arm is designed to deploy the light sensor to take measurements of the surface albedo at locations within a playing field of dimensions approximately 131 × 65 LEGO distance units (1048 mm × 520 mm), within an automated experimental design paradigm [1–3]. The robot is programmed with a set of hypotheses of what shapes it could find placed on the playing field. Instead of being programmed with a specific set of strategies for characterizing the hypothesized shapes, the robot utilizes a generalized Bayesian Inference Engine coupled to an Inquiry Engine to make inferences about the hypotheses based on the recorded data and to use uncertainties in its inferences to drive further exploration by autonomously selecting a new measurement location that promises to provide the maximum amount of relevant information about the problem.In this experiment, the robotic arm is instructed that there is a white circle of unknown radius arbitrarily placed on the black field. Such an instruction is encoded by providing the robot with a model of the surface albedo consisting of three parameters: the center location(xo,yo) and radius ro, written jointly as
(1)C={(xo,yo),ro},
so that given a measurement location (xi,yi) the albedo S is expected to be
(2)S(xi,yi;C)={1ifD((xi,yi),(xo,yo))≤ro,0ifD((xi,yi),(xo,yo))>ro,
where
(3)D((xi,yi),(xo,yo))=(xi-xo)2+(yi-yo)2
is the Euclidean distance between the measurement location (xi,yi) and the center of the circle (xo,yo), and an albedo of 1 signifies that the surface is white and 0 signifies that the surface is black. Precisely how these expectations are used to make inferences from data is explained in the next section. Keep in mind that while the circle’s precise radius and position are unknown, the robot has been provided with limited prior information about the allowable range of radii and positions.Again, it is important to note that the robot does not scan the surface to solve the problem nor does it try to find three points along the edge of the circle. Instead, it employs a general system that works for any expected shape or set of shapes that autonomously and intelligently determines optimal measurement locations based both on what it knows and on what it does not know. The number of measurements needed to characterize all three circle parameters within the desired accuracy is a measure of the efficiency of the experimental procedure.


### 2.3. The Machine Learning System

The machine learning system employs a Bayesian Inference Engine to make inferences about the circle parameters given the recorded light intensities, as well as an Inquiry Engine designed to use the uncertainties in the circle parameter estimates to autonomously select measurement locations that promise to provide the maximum amount of relevant information about the problem.The core of the Bayesian Inference Engine is centered around the computation of the posterior probabilityPr(C∣D,I) of the albedo model parameters, C in (1) given the light sensor recordings (data) di recorded at locations (xi,yi), which we write compactly as
(4)D={(d1,(x1,y1)),…,(dN,(xN,yN))}
and any additional prior information I. Bayes’ Theorem allows one to write the posterior probability as a function of three related probabilities
(5)Pr(C∣D,I)=Pr(C∣I)Pr(D∣C,I)Pr(D∣I),
where the right-hand side consists of the product of the prior probability of the circle parameters Pr(C∣I), which describes what is known about the circle before any sensor data are considered, with a ratio of probabilities that are sensor data dependent. It is in this sense that Bayes’ Theorem represents a learning algorithm since what is known about the circle parameters before the data are considered (prior probability) is modified by the recorded sensor data resulting in a quantification of what is known about the circle parameters after the data are considered (posterior probability). The probability in the numerator on the right is the likelihood Pr(D∣C,I), which quantifies the probability that the sensor data could have resulted from the hypothesized circle parameterized by C. The probability in the denominator is the marginal likelihood or the evidence, which here acts as a normalization factor. Later when estimating the SSF of the light sensor (which is a different problem), the evidence, which can be written as the integral of the product of the prior and the likelihood over all possible model parameters, will play a critical role.The likelihood term,Pr(D∣C,I), plays a critical role in the inference problem, since it essentially compares predictions made using the hypothesized circle parameters to the observed data. A naïve light sensor model would predict that if the sensor was centered on a black region, it would return a small number, and if the sensor was centered on a white region, it would return a large number. A more accurate light sensor model would take into account the SSF of the light sensor and perform an SSF-weighted integral of the hypothesized albedo field and compare this to the recorded sensor data. These two models of the light sensor will be discussed in detail in the next section.The robot not only makes inferences from data, but also designs its own experiments by autonomously deciding where to take subsequent measurements [1–6]. This can be viewed in terms of Bayesian experimental design [7–13] where the Shannon entropy [14] is employed as the utility function to decide where to take the next measurement. In short, the Bayesian Inference Engine samples 50 circles from the posterior probability using the nested sampling algorithm [15, 16]. Since these samples may consist of replications, they are further diversified by taking approximately 1000 Metropolis-Hastings steps [17, 18]. Figure 2 illustrates the robot’s machine learning system’s view of the playing field after several measurements have been recorded. The 50 circles sampled from the posterior probability (blue circles) reflect what the robot knows about the white circle (not shown) given the light sensor data that it has collected. The algorithm then considers a fine grid of potential measurement locations on the playing field. At each potential measurement location, the 50 sampled circles are queried using the likelihood function to produce 50 samples of what measurement could be expected at that location given each hypothesized circle. This results in a set of potential measurement values at each measurement location. The Shannon entropy of the set of potential measurements at each location is computed, which results in an entropy map, which is illustrated in Figure 2 as the copper-toned coloration upon which the blue circles lie. The set of measurement locations with the greatest entropy are identified, and the next measurement location is randomly chosen from that set. Thus the likelihood function not only affects the inferences about the circles made by the machine learning algorithm, but also affects the entropy of the measurement locations, which guides further exploration. In the next section, we describe the two models of the light sensor and their corresponding likelihood functions.Figure 2
This figure illustrates the robot’s machine learning system’s view of the playing field using the naïve light sensor model. The axes label playing field coordinates in LEGO distance units. The previously obtained measurement locations used to obtain light sensor data are indicated by the black and white squares indicating the relative intensity with respect to the naïve light sensor model. The next selected measurement location is indicated by the green square. The blue circles represent the 50 hypothesized circles sampled from the posterior probability. The shaded background represents the entropy map, such that brighter areas indicate the measurement locations that promise to provide greater information about the circle to be characterized. Note that the low entropy area bounded by the white squares indicates that this region is probably inside the white circle and that measurements made here will not be as informative as measurements made elsewhere. The dark jagged edges at the bottom of the colored high entropy regions reflect the boundary between the playing field and the region that is outside of the robotic arm’s reach.The efficacy of the sensor model will be quantified by the average number of measurements the robot needs to make to estimate the circle parameters within a given precision.


### 2.4. Models Describing a Light Sensor

In this section we discuss two models of a light sensor and indicate precisely how they are integrated into the likelihood function used by both the Bayesian Inference and Inquiry Engines.


#### 2.4.1. The Naïve Likelihood

A naïve light sensor model would predict that if the sensor was centered on a black region (surface albedo of zero), the sensor would return a small number on average, and if it were centered on a white region (surface albedo of unity), it would return a large number on average. Of course, there are expected to be noise variations from numerous sources, such as uneven lighting of the surface, minor variations in albedo, and noise in the sensor itself. So one might expect that there is some expected squared deviation from the two mean sensor values for the white and black cases. For this reason, we model the expected sensor response with a Gaussian distribution with meanμB and standard deviation σB for the black surface and a Gaussian distribution with mean μW and standard deviation σW for the white surface. The likelihood of a measurement di at location (xi,yi) corresponding to the naïve light sensor model, Prnaive({(di,(xi,yi))}∣C,I), can be written compactly as
(6)Prnaive({(di,(xi,yi))}∣C,I)={(2πσW)-1/2exp[-(μW-di)22σW2]forD((xi,yi),(xo,yo))≤ro,(2πσB)-1/2exp[-(μB-di)22σB2]forD((xi,yi),(xo,yo))>ro,
where C={(xo,yo),ro} represents the parameters of the hypothesized circle and D((xi,yi),(xo,yo)) is the Euclidean distance given in (3). The joint likelihood for N-independent measurements is found by taking the product of the N single-measurement likelihoods. In a practical experiment, the means μB and μW and standard deviations σB and σW can be easily estimated by sampling known black and white regions several times using the light sensor.


### 2.5. The SSF Likelihood

A more accurate likelihood can be developed by taking into account the fact that the photo diode performs a weighted integral of the light arriving from a spatially distributed region within its field of view, the weights being described by the spatial sensitivity function (SSF) of the sensor. Since the SSF of the light sensor could be arbitrarily complex with many local peaks, but is expected to decrease to zero far from the sensor, we characterize it using a mixture of Gaussians (MoG) model, which we describe in this section.The sensor’s response situated a fixed distance above the point(xi,yi) to a known black-and-white pattern which can be modeled in the lab frame by
(7)M(xi,yi)=Imin+(Imax-Imin)R(xi,yi),
where Imin and Imax are observed intensities for a completely black surface (surface albedo of zero) and a completely white surface (surface albedo of unity), respectively, and R is a scalar response function, varying between zero and one that depends both on the SSF and the surface albedo [19]. The minimum intensity Imin acts as an offset and (Imax-Imin) serves to scale the response to LEGO units.The response of the sensor is described byR(xi,yi), which is a convolution of the sensor SSF and the surface albedo S(x,y) given by
(8)R(xi,yi)=∫dxdySSF(x-xi,y-yi)S(x,y),
where the SSF is defined so that the convolution with a completely white surface results in a response of unity. In practice, we approximate this integral as a sum over a pixelated grid with 1 mm square pixels
(9)R(xi,yi)=∑x,y‍SSF(x-xi,y-yi)S(x,y).We employ a mixture of Gaussians (MOG) as a parameterized model to describe the SSF in the sensor’s frame co-ordinates(x′,y′)=(x-xi,y-yi)(10)SSF(x′,y′)=1K∑n=1N‍an×exp[-{An(x′-un′)2+Bk(y′-vn′)2×exp51555+2Cn(x′-un′)(y′-vn′)An(x′-u′n)2}{An(x′-u′n)2+Bk(y′-v′n)2],
where (un′,vn′) denotes the center of the nth two-dimensional Gaussian with amplitude an and covariance matrix elements given by An, Bn and Cn. The constant K denotes a normalization factor, which ensures that the SSF integrates to unity [19]. The model is sufficiently general so that one could vary the number of Gaussians to any number, although we found that in modeling this light sensor testing models with N varying from N=1 to N=4 was sufficient. The MoG model results in a set of six parameters to be estimated for each Gaussian
(11)θn={an,un′,vn′,An,Bn,Cn},
where the subscript n is used to denote the nth Gaussian in the set. These must be estimated along with the two intensity parameters, Imin and Imax in (7) so that an MoG model with N Gaussians consists of 6N+2 parameters to be estimated.We assign a Student-t distribution to the SSF model likelihood, which can be arrived at by assigning a Gaussian likelihood and integrating over the unknown standard deviation σ [16]. By defining D={(d1,(x1,y1)),(d2,(x2,y2)),…,(dN,(xN,yN))} and writing the hypothesized circle parameters as C={(xo,yo),ro}, we have
(12)PrSSF(D∣C,I)∝[∑i=1N‍(M(xi,yi)-di)2]-(N-1)/2,
where N is the number of measurements made by the robot, and the function M, defined in (7), relies on both (8) and (10). Note that in practice, the MoG SSF model described in (10) is used to generate a discrete SSF matrix which is used in the convolution (9) to compute the likelihood function via the sensor response model M in (7).


### 2.6. Data Collection for SSF Estimation

In this section we describe the collection of the light sensor readings in the laboratory that were used to estimate the SSF of the light sensor. The SSF is a function not only of the properties of the photo diode, but also of the illuminating LED and the height above the surface. For this reason, measurements were made at a height of 14 mm above a surface with a known albedo in a darkened room to avoid complications due to ambient light and to eliminate the possibility of shadows cast by the sensor or other equipment [19].The surface, which we refer to as the black-and-white boundary pattern, consisted of two regions: a black region on the left and a white region on the right separated by a sharp linear boundary as shown in Figure3(a). Here the surface and sensor are illustrated as if viewing them by looking up at them from below the table surface, so that the placement of the photodiode in the sensor package can be visualized. The lab frame was defined to be at the center of the black-white boundary so that the surface albedo, SBW(x,y), is given by
(13)SBW(x,y)={1,forx>0,0,forx≤0.
Measurements were taken as the sensor was incrementally moved, with one-millimeter steps, in a direction perpendicular to the boundary from a position of 5 cm to the left of the boundary (well within the completely black region) to a position 5 cm to the right of the boundary (well within the completely white region) resulting in 101 measurements. This process was repeated four times with the sensor in each of the four orientations (see Figure 3 for an explanation), giving a total of 404 measurements using this pattern.(a) This figure illustrates the laboratory surface, referred to as the black-and-white boundary pattern, with known albedo, which consisted of two regions: a black region on the left and a white region on the right separated by a sharp linear boundary. (b) This illustrates the four sensor orientations used to collect data for the estimation of the SSF along with the symbols used to indicate the measured values plotted in Figure5. The top row views the sensors as if looking up from the table so that the photodiode placement in the sensor package can be visualized. Below these the gray sensor shapes illustrate how they are oriented looking down at both the sensors and the albedo surface. Measurements were taken as the sensor was incrementally moved, with one-millimeter steps, in a direction perpendicular to the boundary (as indicated by the arrow at the bottom of the figure) from a position of 5 cm to the left of the boundary (well within the completely black region) to a position 5 cm to the right of the boundary (well within the completely white region). This process was repeated four times with the sensor in each of the four orientations.
(a)
(b)The black-and-white boundary pattern does not provide sufficient information to uniquely infer the SSF, since the sensor may have a response that is symmetric about a line oriented at 45° with respect to the linear boundary. For this reason, we employed four additional albedo patterns consisting of black regions with one white quadrant as illustrated in Figure4, which resulted in four more measurements. These have surface albedos defined by
(14)Sa(x,y)={1,forx>0mm,y>0mm,0,otherwise,Sb(x,y)={1,forx<0mm,y>0mm,0,otherwise,Sc(x,y)={1,forx>4mm,y>4mm,0,otherwise,Sd(x,y)={1,forx<-4mm,y>4mm,0,otherwise,
where the subscripts relate each albedo function to the pattern illustrated in Figure 4.Four additional symmetry-breaking albedo patterns were employed. In all cases, the sensor was placed in the0° orientation at the center of the pattern, indicated by (0,0). In the two lower patterns, the center of the white square was shifted diagonally from the center by 4 mm as indicated by the coordinates (white text) of the corner. The recorded intensity levels are displayed in the white albedo area.
(a)
(b)
(c)
(d)


### 2.7. Estimating SSF MoG Model Parameters

In this section we describe the application of Bayesian methods to estimate the SSF MoG model parameters. Keep in mind that in this paper we are considering two distinct inference problems: the robot’s inferences about a circle and our inferences about the light sensor SSF. Both of these problems rely on making predictions about measured intensities using a light sensor. For this reason many of these equations will not only look similar to what we have presented previously, but also depend on the same functions mapping modeled albedo fields to predicted sensor responses, which are collectively represented using the generic symbolD. It may help to keep in mind that the robot is characterizing a circle quantified by model parameters represented jointly by the symbol C, and we are estimating the SSF of a light sensor quantified by model parameters represented jointly by the symbol θ below. With the exception of the evidence, represented by function Z below (which is not used by the robot in this experiment), all of the probability functions contain the model parameters in their list of arguments making it clear to which inference problem they refer.The posterior probability for the SSF MoG model parameters, collectively referred to asθ={θ1,θ2,…,θN}, for a model consisting of N Gaussians, is given by
(15)Pr(θ∣D,I)=1ZPr(θ∣I)Pr(D∣θ,I),
where here D refers to the data collected for the SSF estimation experiment described in the previous section, I refers to our prior information about the SSF (which is that it may have several local peaks and falls off to zero far from the sensor), and Z refers to the evidence Z=Pr(D∣I), which can be found by
(16)Z=∫dθPr(θ∣I)Pr(D∣θ,I).
In our earlier discussion where Bayes’ theorem was used to make inferences about circles, the evidence played the role of a normalization factor. Here, since we can consider MoG models with different numbers of Gaussians and since we integrate over all of the possible values of the parameters, the evidence quantifies the degree to which the hypothesized model order N supports the data. That is, the optimal number of Gaussians to be used in the MoG model of the SSF can be found by computing the evidence.All five sets of dataD described in the previous section were used to compute the posterior probability. These are each indexed by the subscript i where i=1,2,3,4, so that Di refers to the data collected using each of the four orientations ϕi={0°,90°,180°,270°} to scan the black-and-white boundary pattern resulting in Ni=101 measurements for i=1,2,3,4, and where the value i=5 refers to the Ni=4 measurements attained using the 0° orientation with the set of four additional patterns.We assign uniform priors so that this is essentially a maximum likelihood calculation with the posterior being proportional to the likelihood. We assign a Student-t distribution to the likelihood, which can be arrived at by assigning a Gaussian likelihood and integrating over the unknown standard deviation σ [16]. This can be written as
(17)Pr(Di∣θ,I)∝[∑j=1Ni‍(Mij(xij,yij)-Di(xij,yij))2]-(Ni-1)/2,
where i denotes each of the five sets of data and j denotes the jth measurement of that set, which was taken at position (xij,yij). The function Mij(x,y) represents a predicted measurement value obtained from (7) using (9) with the albedo function S(x,y) defined using the albedo pattern SBW(x,y) with orientation ϕi for i=1,2,3,4 and the albedo patterns Sa, Sb, Sc, Sd for i=5 and j=1,2,3,4, respectively. As such the likelihood relies on a difference between predicted and measured sensor responses.The joint likelihood for the five data sets is found by taking the product of the likelihoods for each data set, since we expect that the standard deviations that were marginalized over to get the Student-t distribution could have been different for each of the five data sets as they were not all recorded at the same time
(18)Pr(D∣θ,I)=∏i=15‍Pr(Di∣θ,I).We employed nested sampling [15, 16] to explore the posterior probability since, in addition to providing parameter estimates, it is explicitly designed to perform evidence calculations, which we use to perform model comparison in identifying the most probable number of Gaussians in the MoG model. For each of the four MoG models (number of Gaussians varying from one to four) the nested sampling algorithm was initialized with 300 samples and iterated until the change in consecutive log-evidence values is less than 10-8. Typically one estimates the mean parameter values by taking an average of the samples weighted by a quantity computed by the nested sampling algorithm called the logWt in [15, 16]. Here we simply performed a logWt-weighted average of the sampled SSF fields computed using the sampled MoG model parameters (rather than the logWt-weighted average of the MoG model parameters themselves), so the result obtained using an MoG model consisting of a single Gaussian is not strictly a single two-dimensional Gaussian distribution. It is this discretized estimated SSF field matrix that is used directly in the convolution (9) to compute the likelihood functions as mentioned earlier in the last lines of Section 2.5.


## 2.1. Robotic Arm Test Bed

The robotic arm is designed to perform studies in autonomous experimental design [1, 2]. The robot itself is constructed using the LEGO NXT Mindstorms system (Figure 1). The LEGO Mindstorms system was utilized in part to demonstrate that high-quality autonomous systems can be achieved when using lower quality equipment if the machine learning and data analysis algorithms are handled carefully. It employs one motor to allow it to rotate about a vertical axis indicated by the black line in the top center of the figure and two motors to extend and lower the arm about the joints located at the positions indicated by the short arrows. The motors are controlled directly by the LEGO brick, which is commanded via Bluetooth by a Dell Latitude laptop computer running the robot’s machine learning system, which is programmed in MatLab (Mathworks, Inc.). The LEGO light sensor is attached to the end of the arm (indicated by the long arrow in Figure 1 and displayed in the inset at the upper right). Based on commands issued by the laptop, the robotic arm can deploy the light sensor to any position within its reach on the playing field. The light sensor is lowered to an average height of 14 mm above the surface before taking a measurement. The arm is designed using a trapezoidal construction that maintains the sensor’s orientation to be aimed at nadir, always normal to the surface, despite the extension of the arm.Figure 1
A photograph showing the robotic arm along with the circle it is programmed to characterize. The robotic arm is constructed using the LEGO NXT Mindstorms System. It employs one motor to allow it to rotate about a vertical axis indicated by the black line in the top center of the image and two motors to extend and lower the arm about the joints located at the positions indicated by the short arrows. The LEGO light sensor, also shown in the inset, is attached to the end of the arm as indicated by the long arrow.The LEGO light sensor (LEGO Part 9844) consists of a photodiode-LED pair. The white circle is the photo diode, and the red circle is the illuminating LED. Note that they are separated by a narrow plastic ridge, which prevents the LED from shining directly into the photo diode. This ridge, along with the plastic lenses and the presence of the illuminating LED, affects the spatial sensitivity of the sensor. When activated, the light sensor flashes for a brief instant and measures the intensity of the reflected light. The photo diode and its support circuitry are connected to the sensor port of the LEGO Brick (LEGO Part 9841), which runs on a 32 bit ARM7 ATMEL microcontroller. The measured intensities are converted by internal software running on the ATMEL microcontroller to a scale of 1 to 100, which we refer to asLEGO units. The light sensor integrates the light arriving from a spatially distributed region within its field of view. The spatial sensitivity of the sensor to light sources within its field of view is described by the spatial sensitivity function (SSF). This function is unknown, but if it were known, one could weight the surface albedo field with the SSF and integrate to obtain an estimate of the recorded intensity of the reflected light.


## 2.2. The Circle Characterization Experiment

The robotic arm is designed to deploy the light sensor to take measurements of the surface albedo at locations within a playing field of dimensions approximately 131 × 65 LEGO distance units (1048 mm × 520 mm), within an automated experimental design paradigm [1–3]. The robot is programmed with a set of hypotheses of what shapes it could find placed on the playing field. Instead of being programmed with a specific set of strategies for characterizing the hypothesized shapes, the robot utilizes a generalized Bayesian Inference Engine coupled to an Inquiry Engine to make inferences about the hypotheses based on the recorded data and to use uncertainties in its inferences to drive further exploration by autonomously selecting a new measurement location that promises to provide the maximum amount of relevant information about the problem.In this experiment, the robotic arm is instructed that there is a white circle of unknown radius arbitrarily placed on the black field. Such an instruction is encoded by providing the robot with a model of the surface albedo consisting of three parameters: the center location(xo,yo) and radius ro, written jointly as
(1)C={(xo,yo),ro},
so that given a measurement location (xi,yi) the albedo S is expected to be
(2)S(xi,yi;C)={1ifD((xi,yi),(xo,yo))≤ro,0ifD((xi,yi),(xo,yo))>ro,
where
(3)D((xi,yi),(xo,yo))=(xi-xo)2+(yi-yo)2
is the Euclidean distance between the measurement location (xi,yi) and the center of the circle (xo,yo), and an albedo of 1 signifies that the surface is white and 0 signifies that the surface is black. Precisely how these expectations are used to make inferences from data is explained in the next section. Keep in mind that while the circle’s precise radius and position are unknown, the robot has been provided with limited prior information about the allowable range of radii and positions.Again, it is important to note that the robot does not scan the surface to solve the problem nor does it try to find three points along the edge of the circle. Instead, it employs a general system that works for any expected shape or set of shapes that autonomously and intelligently determines optimal measurement locations based both on what it knows and on what it does not know. The number of measurements needed to characterize all three circle parameters within the desired accuracy is a measure of the efficiency of the experimental procedure.


## 2.3. The Machine Learning System

The machine learning system employs a Bayesian Inference Engine to make inferences about the circle parameters given the recorded light intensities, as well as an Inquiry Engine designed to use the uncertainties in the circle parameter estimates to autonomously select measurement locations that promise to provide the maximum amount of relevant information about the problem.The core of the Bayesian Inference Engine is centered around the computation of the posterior probabilityPr(C∣D,I) of the albedo model parameters, C in (1) given the light sensor recordings (data) di recorded at locations (xi,yi), which we write compactly as
(4)D={(d1,(x1,y1)),…,(dN,(xN,yN))}
and any additional prior information I. Bayes’ Theorem allows one to write the posterior probability as a function of three related probabilities
(5)Pr(C∣D,I)=Pr(C∣I)Pr(D∣C,I)Pr(D∣I),
where the right-hand side consists of the product of the prior probability of the circle parameters Pr(C∣I), which describes what is known about the circle before any sensor data are considered, with a ratio of probabilities that are sensor data dependent. It is in this sense that Bayes’ Theorem represents a learning algorithm since what is known about the circle parameters before the data are considered (prior probability) is modified by the recorded sensor data resulting in a quantification of what is known about the circle parameters after the data are considered (posterior probability). The probability in the numerator on the right is the likelihood Pr(D∣C,I), which quantifies the probability that the sensor data could have resulted from the hypothesized circle parameterized by C. The probability in the denominator is the marginal likelihood or the evidence, which here acts as a normalization factor. Later when estimating the SSF of the light sensor (which is a different problem), the evidence, which can be written as the integral of the product of the prior and the likelihood over all possible model parameters, will play a critical role.The likelihood term,Pr(D∣C,I), plays a critical role in the inference problem, since it essentially compares predictions made using the hypothesized circle parameters to the observed data. A naïve light sensor model would predict that if the sensor was centered on a black region, it would return a small number, and if the sensor was centered on a white region, it would return a large number. A more accurate light sensor model would take into account the SSF of the light sensor and perform an SSF-weighted integral of the hypothesized albedo field and compare this to the recorded sensor data. These two models of the light sensor will be discussed in detail in the next section.The robot not only makes inferences from data, but also designs its own experiments by autonomously deciding where to take subsequent measurements [1–6]. This can be viewed in terms of Bayesian experimental design [7–13] where the Shannon entropy [14] is employed as the utility function to decide where to take the next measurement. In short, the Bayesian Inference Engine samples 50 circles from the posterior probability using the nested sampling algorithm [15, 16]. Since these samples may consist of replications, they are further diversified by taking approximately 1000 Metropolis-Hastings steps [17, 18]. Figure 2 illustrates the robot’s machine learning system’s view of the playing field after several measurements have been recorded. The 50 circles sampled from the posterior probability (blue circles) reflect what the robot knows about the white circle (not shown) given the light sensor data that it has collected. The algorithm then considers a fine grid of potential measurement locations on the playing field. At each potential measurement location, the 50 sampled circles are queried using the likelihood function to produce 50 samples of what measurement could be expected at that location given each hypothesized circle. This results in a set of potential measurement values at each measurement location. The Shannon entropy of the set of potential measurements at each location is computed, which results in an entropy map, which is illustrated in Figure 2 as the copper-toned coloration upon which the blue circles lie. The set of measurement locations with the greatest entropy are identified, and the next measurement location is randomly chosen from that set. Thus the likelihood function not only affects the inferences about the circles made by the machine learning algorithm, but also affects the entropy of the measurement locations, which guides further exploration. In the next section, we describe the two models of the light sensor and their corresponding likelihood functions.Figure 2
This figure illustrates the robot’s machine learning system’s view of the playing field using the naïve light sensor model. The axes label playing field coordinates in LEGO distance units. The previously obtained measurement locations used to obtain light sensor data are indicated by the black and white squares indicating the relative intensity with respect to the naïve light sensor model. The next selected measurement location is indicated by the green square. The blue circles represent the 50 hypothesized circles sampled from the posterior probability. The shaded background represents the entropy map, such that brighter areas indicate the measurement locations that promise to provide greater information about the circle to be characterized. Note that the low entropy area bounded by the white squares indicates that this region is probably inside the white circle and that measurements made here will not be as informative as measurements made elsewhere. The dark jagged edges at the bottom of the colored high entropy regions reflect the boundary between the playing field and the region that is outside of the robotic arm’s reach.The efficacy of the sensor model will be quantified by the average number of measurements the robot needs to make to estimate the circle parameters within a given precision.


## 2.4. Models Describing a Light Sensor

In this section we discuss two models of a light sensor and indicate precisely how they are integrated into the likelihood function used by both the Bayesian Inference and Inquiry Engines.


### 2.4.1. The Naïve Likelihood

A naïve light sensor model would predict that if the sensor was centered on a black region (surface albedo of zero), the sensor would return a small number on average, and if it were centered on a white region (surface albedo of unity), it would return a large number on average. Of course, there are expected to be noise variations from numerous sources, such as uneven lighting of the surface, minor variations in albedo, and noise in the sensor itself. So one might expect that there is some expected squared deviation from the two mean sensor values for the white and black cases. For this reason, we model the expected sensor response with a Gaussian distribution with meanμB and standard deviation σB for the black surface and a Gaussian distribution with mean μW and standard deviation σW for the white surface. The likelihood of a measurement di at location (xi,yi) corresponding to the naïve light sensor model, Prnaive({(di,(xi,yi))}∣C,I), can be written compactly as
(6)Prnaive({(di,(xi,yi))}∣C,I)={(2πσW)-1/2exp[-(μW-di)22σW2]forD((xi,yi),(xo,yo))≤ro,(2πσB)-1/2exp[-(μB-di)22σB2]forD((xi,yi),(xo,yo))>ro,
where C={(xo,yo),ro} represents the parameters of the hypothesized circle and D((xi,yi),(xo,yo)) is the Euclidean distance given in (3). The joint likelihood for N-independent measurements is found by taking the product of the N single-measurement likelihoods. In a practical experiment, the means μB and μW and standard deviations σB and σW can be easily estimated by sampling known black and white regions several times using the light sensor.


## 2.4.1. The Naïve Likelihood

A naïve light sensor model would predict that if the sensor was centered on a black region (surface albedo of zero), the sensor would return a small number on average, and if it were centered on a white region (surface albedo of unity), it would return a large number on average. Of course, there are expected to be noise variations from numerous sources, such as uneven lighting of the surface, minor variations in albedo, and noise in the sensor itself. So one might expect that there is some expected squared deviation from the two mean sensor values for the white and black cases. For this reason, we model the expected sensor response with a Gaussian distribution with meanμB and standard deviation σB for the black surface and a Gaussian distribution with mean μW and standard deviation σW for the white surface. The likelihood of a measurement di at location (xi,yi) corresponding to the naïve light sensor model, Prnaive({(di,(xi,yi))}∣C,I), can be written compactly as
(6)Prnaive({(di,(xi,yi))}∣C,I)={(2πσW)-1/2exp[-(μW-di)22σW2]forD((xi,yi),(xo,yo))≤ro,(2πσB)-1/2exp[-(μB-di)22σB2]forD((xi,yi),(xo,yo))>ro,
where C={(xo,yo),ro} represents the parameters of the hypothesized circle and D((xi,yi),(xo,yo)) is the Euclidean distance given in (3). The joint likelihood for N-independent measurements is found by taking the product of the N single-measurement likelihoods. In a practical experiment, the means μB and μW and standard deviations σB and σW can be easily estimated by sampling known black and white regions several times using the light sensor.


## 2.5. The SSF Likelihood

A more accurate likelihood can be developed by taking into account the fact that the photo diode performs a weighted integral of the light arriving from a spatially distributed region within its field of view, the weights being described by the spatial sensitivity function (SSF) of the sensor. Since the SSF of the light sensor could be arbitrarily complex with many local peaks, but is expected to decrease to zero far from the sensor, we characterize it using a mixture of Gaussians (MoG) model, which we describe in this section.The sensor’s response situated a fixed distance above the point(xi,yi) to a known black-and-white pattern which can be modeled in the lab frame by
(7)M(xi,yi)=Imin+(Imax-Imin)R(xi,yi),
where Imin and Imax are observed intensities for a completely black surface (surface albedo of zero) and a completely white surface (surface albedo of unity), respectively, and R is a scalar response function, varying between zero and one that depends both on the SSF and the surface albedo [19]. The minimum intensity Imin acts as an offset and (Imax-Imin) serves to scale the response to LEGO units.The response of the sensor is described byR(xi,yi), which is a convolution of the sensor SSF and the surface albedo S(x,y) given by
(8)R(xi,yi)=∫dxdySSF(x-xi,y-yi)S(x,y),
where the SSF is defined so that the convolution with a completely white surface results in a response of unity. In practice, we approximate this integral as a sum over a pixelated grid with 1 mm square pixels
(9)R(xi,yi)=∑x,y‍SSF(x-xi,y-yi)S(x,y).We employ a mixture of Gaussians (MOG) as a parameterized model to describe the SSF in the sensor’s frame co-ordinates(x′,y′)=(x-xi,y-yi)(10)SSF(x′,y′)=1K∑n=1N‍an×exp[-{An(x′-un′)2+Bk(y′-vn′)2×exp51555+2Cn(x′-un′)(y′-vn′)An(x′-u′n)2}{An(x′-u′n)2+Bk(y′-v′n)2],
where (un′,vn′) denotes the center of the nth two-dimensional Gaussian with amplitude an and covariance matrix elements given by An, Bn and Cn. The constant K denotes a normalization factor, which ensures that the SSF integrates to unity [19]. The model is sufficiently general so that one could vary the number of Gaussians to any number, although we found that in modeling this light sensor testing models with N varying from N=1 to N=4 was sufficient. The MoG model results in a set of six parameters to be estimated for each Gaussian
(11)θn={an,un′,vn′,An,Bn,Cn},
where the subscript n is used to denote the nth Gaussian in the set. These must be estimated along with the two intensity parameters, Imin and Imax in (7) so that an MoG model with N Gaussians consists of 6N+2 parameters to be estimated.We assign a Student-t distribution to the SSF model likelihood, which can be arrived at by assigning a Gaussian likelihood and integrating over the unknown standard deviation σ [16]. By defining D={(d1,(x1,y1)),(d2,(x2,y2)),…,(dN,(xN,yN))} and writing the hypothesized circle parameters as C={(xo,yo),ro}, we have
(12)PrSSF(D∣C,I)∝[∑i=1N‍(M(xi,yi)-di)2]-(N-1)/2,
where N is the number of measurements made by the robot, and the function M, defined in (7), relies on both (8) and (10). Note that in practice, the MoG SSF model described in (10) is used to generate a discrete SSF matrix which is used in the convolution (9) to compute the likelihood function via the sensor response model M in (7).


## 2.6. Data Collection for SSF Estimation

In this section we describe the collection of the light sensor readings in the laboratory that were used to estimate the SSF of the light sensor. The SSF is a function not only of the properties of the photo diode, but also of the illuminating LED and the height above the surface. For this reason, measurements were made at a height of 14 mm above a surface with a known albedo in a darkened room to avoid complications due to ambient light and to eliminate the possibility of shadows cast by the sensor or other equipment [19].The surface, which we refer to as the black-and-white boundary pattern, consisted of two regions: a black region on the left and a white region on the right separated by a sharp linear boundary as shown in Figure3(a). Here the surface and sensor are illustrated as if viewing them by looking up at them from below the table surface, so that the placement of the photodiode in the sensor package can be visualized. The lab frame was defined to be at the center of the black-white boundary so that the surface albedo, SBW(x,y), is given by
(13)SBW(x,y)={1,forx>0,0,forx≤0.
Measurements were taken as the sensor was incrementally moved, with one-millimeter steps, in a direction perpendicular to the boundary from a position of 5 cm to the left of the boundary (well within the completely black region) to a position 5 cm to the right of the boundary (well within the completely white region) resulting in 101 measurements. This process was repeated four times with the sensor in each of the four orientations (see Figure 3 for an explanation), giving a total of 404 measurements using this pattern.(a) This figure illustrates the laboratory surface, referred to as the black-and-white boundary pattern, with known albedo, which consisted of two regions: a black region on the left and a white region on the right separated by a sharp linear boundary. (b) This illustrates the four sensor orientations used to collect data for the estimation of the SSF along with the symbols used to indicate the measured values plotted in Figure5. The top row views the sensors as if looking up from the table so that the photodiode placement in the sensor package can be visualized. Below these the gray sensor shapes illustrate how they are oriented looking down at both the sensors and the albedo surface. Measurements were taken as the sensor was incrementally moved, with one-millimeter steps, in a direction perpendicular to the boundary (as indicated by the arrow at the bottom of the figure) from a position of 5 cm to the left of the boundary (well within the completely black region) to a position 5 cm to the right of the boundary (well within the completely white region). This process was repeated four times with the sensor in each of the four orientations.
(a)
(b)The black-and-white boundary pattern does not provide sufficient information to uniquely infer the SSF, since the sensor may have a response that is symmetric about a line oriented at 45° with respect to the linear boundary. For this reason, we employed four additional albedo patterns consisting of black regions with one white quadrant as illustrated in Figure4, which resulted in four more measurements. These have surface albedos defined by
(14)Sa(x,y)={1,forx>0mm,y>0mm,0,otherwise,Sb(x,y)={1,forx<0mm,y>0mm,0,otherwise,Sc(x,y)={1,forx>4mm,y>4mm,0,otherwise,Sd(x,y)={1,forx<-4mm,y>4mm,0,otherwise,
where the subscripts relate each albedo function to the pattern illustrated in Figure 4.Four additional symmetry-breaking albedo patterns were employed. In all cases, the sensor was placed in the0° orientation at the center of the pattern, indicated by (0,0). In the two lower patterns, the center of the white square was shifted diagonally from the center by 4 mm as indicated by the coordinates (white text) of the corner. The recorded intensity levels are displayed in the white albedo area.
(a)
(b)
(c)
(d)


## 2.7. Estimating SSF MoG Model Parameters

In this section we describe the application of Bayesian methods to estimate the SSF MoG model parameters. Keep in mind that in this paper we are considering two distinct inference problems: the robot’s inferences about a circle and our inferences about the light sensor SSF. Both of these problems rely on making predictions about measured intensities using a light sensor. For this reason many of these equations will not only look similar to what we have presented previously, but also depend on the same functions mapping modeled albedo fields to predicted sensor responses, which are collectively represented using the generic symbolD. It may help to keep in mind that the robot is characterizing a circle quantified by model parameters represented jointly by the symbol C, and we are estimating the SSF of a light sensor quantified by model parameters represented jointly by the symbol θ below. With the exception of the evidence, represented by function Z below (which is not used by the robot in this experiment), all of the probability functions contain the model parameters in their list of arguments making it clear to which inference problem they refer.The posterior probability for the SSF MoG model parameters, collectively referred to asθ={θ1,θ2,…,θN}, for a model consisting of N Gaussians, is given by
(15)Pr(θ∣D,I)=1ZPr(θ∣I)Pr(D∣θ,I),
where here D refers to the data collected for the SSF estimation experiment described in the previous section, I refers to our prior information about the SSF (which is that it may have several local peaks and falls off to zero far from the sensor), and Z refers to the evidence Z=Pr(D∣I), which can be found by
(16)Z=∫dθPr(θ∣I)Pr(D∣θ,I).
In our earlier discussion where Bayes’ theorem was used to make inferences about circles, the evidence played the role of a normalization factor. Here, since we can consider MoG models with different numbers of Gaussians and since we integrate over all of the possible values of the parameters, the evidence quantifies the degree to which the hypothesized model order N supports the data. That is, the optimal number of Gaussians to be used in the MoG model of the SSF can be found by computing the evidence.All five sets of dataD described in the previous section were used to compute the posterior probability. These are each indexed by the subscript i where i=1,2,3,4, so that Di refers to the data collected using each of the four orientations ϕi={0°,90°,180°,270°} to scan the black-and-white boundary pattern resulting in Ni=101 measurements for i=1,2,3,4, and where the value i=5 refers to the Ni=4 measurements attained using the 0° orientation with the set of four additional patterns.We assign uniform priors so that this is essentially a maximum likelihood calculation with the posterior being proportional to the likelihood. We assign a Student-t distribution to the likelihood, which can be arrived at by assigning a Gaussian likelihood and integrating over the unknown standard deviation σ [16]. This can be written as
(17)Pr(Di∣θ,I)∝[∑j=1Ni‍(Mij(xij,yij)-Di(xij,yij))2]-(Ni-1)/2,
where i denotes each of the five sets of data and j denotes the jth measurement of that set, which was taken at position (xij,yij). The function Mij(x,y) represents a predicted measurement value obtained from (7) using (9) with the albedo function S(x,y) defined using the albedo pattern SBW(x,y) with orientation ϕi for i=1,2,3,4 and the albedo patterns Sa, Sb, Sc, Sd for i=5 and j=1,2,3,4, respectively. As such the likelihood relies on a difference between predicted and measured sensor responses.The joint likelihood for the five data sets is found by taking the product of the likelihoods for each data set, since we expect that the standard deviations that were marginalized over to get the Student-t distribution could have been different for each of the five data sets as they were not all recorded at the same time
(18)Pr(D∣θ,I)=∏i=15‍Pr(Di∣θ,I).We employed nested sampling [15, 16] to explore the posterior probability since, in addition to providing parameter estimates, it is explicitly designed to perform evidence calculations, which we use to perform model comparison in identifying the most probable number of Gaussians in the MoG model. For each of the four MoG models (number of Gaussians varying from one to four) the nested sampling algorithm was initialized with 300 samples and iterated until the change in consecutive log-evidence values is less than 10-8. Typically one estimates the mean parameter values by taking an average of the samples weighted by a quantity computed by the nested sampling algorithm called the logWt in [15, 16]. Here we simply performed a logWt-weighted average of the sampled SSF fields computed using the sampled MoG model parameters (rather than the logWt-weighted average of the MoG model parameters themselves), so the result obtained using an MoG model consisting of a single Gaussian is not strictly a single two-dimensional Gaussian distribution. It is this discretized estimated SSF field matrix that is used directly in the convolution (9) to compute the likelihood functions as mentioned earlier in the last lines of Section 2.5.


## 3. Results and Discussion

In this section we present the SSF MoG light sensor model estimated from the laboratory data and evaluate its efficacy by demonstrating a significant improvement of the performance in the autonomous robotic platform.


### 3.1. Light Sensor SSF MoG Model

The light sensor data collected using the black-and-white boundary pattern are illustrated in Figure5. One can see that the intensity recorded by the sensor increases dramatically as the sensor crosses the boundary from the black region to the white region, but the change is not a step function, which indicates the finite size of the surface area integrated by the sensor. It is this effect that is to be modeled by the SSF function. There is an obvious asymmetry between the 90° and 270° orientations due to the shift of the transition region. In addition, there is a significant difference in slope of the transition region between the 0°, 180° orientations and the 90°, 270° orientations indicating a significant difference in the width of the SSF in those directions. Note also that the minimum recorded response is not zero, as the reflectance of the black surface is not completely zero.Figure 5
This figure illustrates the intensity measurements,D1, D2, D3, D4 from the four sensor orientations, recorded from the sensor using the black-and-white boundary pattern. Figure 3 shows the orientations of the sensor corresponding to the symbols used in this figure.The nested sampling algorithm produced the mean SSF fields for each of the MoG models tested, as well as the corresponding log evidence. Table1, which lists the log evidence computed for each MoG model order, illustrates that the most probable model was obtained from the single two-dimensional Gaussian models by a factor of about exp(9), which means that it is about 8000 times more probable than the MoG consisting of two Gaussians. Figure 6 shows the mean SSF fields described by the MoG models of different orders. In all cases, the center of the SSF is shifted slightly above the physical center of the sensor package due to the placement of the photodiode (refer to Figure 1) as indicated by the data in Figure 5. In addition, as predicted, one sees that the SSF is wider along the 90°–270° axis than along the 0°–180° axis. Last, Figure 7 demonstrates that the predicted light sensor output shows excellent similarity to the recorded data for the black-and-white boundary pattern.Table 1
A comparison of the tested MoG SSF models and their respective log evidence (in units ofdata-408).
MoG model order
Log evidence
Number of parameters
1 Gaussian
-
665.5
±
0.3
6
2 Gaussian
-
674.9
±
0.3
12
3 Gaussian
-
671.9
±
0.4
18
4 Gaussian
-
706.1
±
0.4
24This figure illustrates the SSF obtained from the four MoG models along with their corresponding log-evidence values.
(a)
(b)
(c)
(d)Figure 7
A comparison of the observed data (red) with predictions (black) made by the SSF field estimated using the single two-dimensional Gaussian MoG model.In the next section, we demonstrate that explicit knowledge about how the light sensor integrates light arriving from within its field-of-view improves the inferences one can make from its output.


### 3.2. Efficacy of Sensor Model

The mean SSF field obtained using a single two-dimensional Gaussian model (Figure6(a)) was incorporated into the likelihood function used by the robot’s machine learning system. Here we compare the robot’s performance in locating and characterizing a circle by observing the average number of measurements necessary to characterize the circle parameters within a precision of 4 mm (which is one-half of the spacing between the holes in the LEGO technic parts).The three panels comprising Figure8(a) illustrate the robot’s machine learning system’s view of the playing field using the naïve light sensor model. The previously obtained measurement locations used to obtain light sensor data are indicated by the black and white squares indicating the relative intensity with respect to the naïve light sensor model. The next selected measurement location is indicated by the green square. The blue circles represent the 50 hypothesized circles sampled from the posterior probability. The shaded background represents the entropy map, which indicates the measurement locations that promise to provide maximal information about the circle to be characterized. The low entropy area surrounding the white square indicates that the region is probably inside the white circle (not shown) and that measurements made there will not be as informative as measurements made elsewhere. Note that the circles partition the plane and that each partition has a uniform entropy. All measurement locations within that partition, or any other partition sharing the same entropy, all stand to be equally informative. Here it is the fact that the shape is known to be a circle that is driving the likelihood function.(a) These three panels illustrate the robot’s machine learning system’s view of the playing field using the naïve light sensor model as the system progresses through the first three measurements. The previously obtained measurement locations used to obtain light sensor data are indicated by the black-and-white squares indicating the relative intensity with respect to the naïve light sensor model. The next selected measurement location is indicated by the green square. The blue circles represent the 50 hypothesized circles sampled from the posterior probability. The shaded background represents the entropy map, which indicates the measurement locations that promise to provide maximal information about the circle to be characterized. Note that the low entropy area surrounding the white square indicates that the region is probably inside the white circle (not shown) and that measurements made there will not be as informative as measurements made elsewhere. The entropy map in Figure2 shows the same experiment at a later stage after seven measurements have been recorded. (b) These three panels illustrate the robot’s machine learning system’s view of the playing field using the more accurate SSF light sensor model. Note that the entropy map reveals the circle edges to be highly informative. This is because it helps to identify not only whether the sensor is inside the circle (as is accomplished using the naïve light sensor model on the left), but also the extent to which the sensor is on the edge of the circle.
(a)
(b)In contrast, the three panels comprising Figure8(b) illustrate the playing field using the more accurate SSF model. Here one can see that the entropy is higher along the edges of the sampled circles. This indicates that the circle edges promise to provide more information than the centers of the partitioned regions. This is because that the SSF model enables one to detect not only whether the light sensor is situated above the circles edge but also how much of the SSF overlaps with the white circle. That is, it helps to identify not only whether the sensor is inside the circle (as is accomplished using the naïve light sensor model), but also the extent to which the sensor is on the edge of the circle. The additional information provided about the functioning of the light sensor translates directly into additional information about the albedo that results in the sensor output.This additional information can be quantified by observing how many measurements the robot is required to take to obtain estimates of the circle parameters within the same precision in the cases of each light sensor model. Our experiments revealed that on average it takes 19 ± 1.8 measurements using the naïve light sensor model compared to an average of 11.6 ± 3.9 measurements for the more accurate SSF light sensor model.


## 3.1. Light Sensor SSF MoG Model

The light sensor data collected using the black-and-white boundary pattern are illustrated in Figure5. One can see that the intensity recorded by the sensor increases dramatically as the sensor crosses the boundary from the black region to the white region, but the change is not a step function, which indicates the finite size of the surface area integrated by the sensor. It is this effect that is to be modeled by the SSF function. There is an obvious asymmetry between the 90° and 270° orientations due to the shift of the transition region. In addition, there is a significant difference in slope of the transition region between the 0°, 180° orientations and the 90°, 270° orientations indicating a significant difference in the width of the SSF in those directions. Note also that the minimum recorded response is not zero, as the reflectance of the black surface is not completely zero.Figure 5
This figure illustrates the intensity measurements,D1, D2, D3, D4 from the four sensor orientations, recorded from the sensor using the black-and-white boundary pattern. Figure 3 shows the orientations of the sensor corresponding to the symbols used in this figure.The nested sampling algorithm produced the mean SSF fields for each of the MoG models tested, as well as the corresponding log evidence. Table1, which lists the log evidence computed for each MoG model order, illustrates that the most probable model was obtained from the single two-dimensional Gaussian models by a factor of about exp(9), which means that it is about 8000 times more probable than the MoG consisting of two Gaussians. Figure 6 shows the mean SSF fields described by the MoG models of different orders. In all cases, the center of the SSF is shifted slightly above the physical center of the sensor package due to the placement of the photodiode (refer to Figure 1) as indicated by the data in Figure 5. In addition, as predicted, one sees that the SSF is wider along the 90°–270° axis than along the 0°–180° axis. Last, Figure 7 demonstrates that the predicted light sensor output shows excellent similarity to the recorded data for the black-and-white boundary pattern.Table 1
A comparison of the tested MoG SSF models and their respective log evidence (in units ofdata-408).
MoG model order
Log evidence
Number of parameters
1 Gaussian
-
665.5
±
0.3
6
2 Gaussian
-
674.9
±
0.3
12
3 Gaussian
-
671.9
±
0.4
18
4 Gaussian
-
706.1
±
0.4
24This figure illustrates the SSF obtained from the four MoG models along with their corresponding log-evidence values.
(a)
(b)
(c)
(d)Figure 7
A comparison of the observed data (red) with predictions (black) made by the SSF field estimated using the single two-dimensional Gaussian MoG model.In the next section, we demonstrate that explicit knowledge about how the light sensor integrates light arriving from within its field-of-view improves the inferences one can make from its output.


## 3.2. Efficacy of Sensor Model

The mean SSF field obtained using a single two-dimensional Gaussian model (Figure6(a)) was incorporated into the likelihood function used by the robot’s machine learning system. Here we compare the robot’s performance in locating and characterizing a circle by observing the average number of measurements necessary to characterize the circle parameters within a precision of 4 mm (which is one-half of the spacing between the holes in the LEGO technic parts).The three panels comprising Figure8(a) illustrate the robot’s machine learning system’s view of the playing field using the naïve light sensor model. The previously obtained measurement locations used to obtain light sensor data are indicated by the black and white squares indicating the relative intensity with respect to the naïve light sensor model. The next selected measurement location is indicated by the green square. The blue circles represent the 50 hypothesized circles sampled from the posterior probability. The shaded background represents the entropy map, which indicates the measurement locations that promise to provide maximal information about the circle to be characterized. The low entropy area surrounding the white square indicates that the region is probably inside the white circle (not shown) and that measurements made there will not be as informative as measurements made elsewhere. Note that the circles partition the plane and that each partition has a uniform entropy. All measurement locations within that partition, or any other partition sharing the same entropy, all stand to be equally informative. Here it is the fact that the shape is known to be a circle that is driving the likelihood function.(a) These three panels illustrate the robot’s machine learning system’s view of the playing field using the naïve light sensor model as the system progresses through the first three measurements. The previously obtained measurement locations used to obtain light sensor data are indicated by the black-and-white squares indicating the relative intensity with respect to the naïve light sensor model. The next selected measurement location is indicated by the green square. The blue circles represent the 50 hypothesized circles sampled from the posterior probability. The shaded background represents the entropy map, which indicates the measurement locations that promise to provide maximal information about the circle to be characterized. Note that the low entropy area surrounding the white square indicates that the region is probably inside the white circle (not shown) and that measurements made there will not be as informative as measurements made elsewhere. The entropy map in Figure2 shows the same experiment at a later stage after seven measurements have been recorded. (b) These three panels illustrate the robot’s machine learning system’s view of the playing field using the more accurate SSF light sensor model. Note that the entropy map reveals the circle edges to be highly informative. This is because it helps to identify not only whether the sensor is inside the circle (as is accomplished using the naïve light sensor model on the left), but also the extent to which the sensor is on the edge of the circle.
(a)
(b)In contrast, the three panels comprising Figure8(b) illustrate the playing field using the more accurate SSF model. Here one can see that the entropy is higher along the edges of the sampled circles. This indicates that the circle edges promise to provide more information than the centers of the partitioned regions. This is because that the SSF model enables one to detect not only whether the light sensor is situated above the circles edge but also how much of the SSF overlaps with the white circle. That is, it helps to identify not only whether the sensor is inside the circle (as is accomplished using the naïve light sensor model), but also the extent to which the sensor is on the edge of the circle. The additional information provided about the functioning of the light sensor translates directly into additional information about the albedo that results in the sensor output.This additional information can be quantified by observing how many measurements the robot is required to take to obtain estimates of the circle parameters within the same precision in the cases of each light sensor model. Our experiments revealed that on average it takes 19 ± 1.8 measurements using the naïve light sensor model compared to an average of 11.6 ± 3.9 measurements for the more accurate SSF light sensor model.


## 4. Conclusion

The quality of the inferences one makes from a sensor depend, not only on the quality of the data returned by the sensor, but also on the information one possesses about the sensor’s performance. In this paper we have demonstrated via a case study, how more precisely modeling a sensor’s performance can improve the inferences one can make from its data. In this case, we demonstrated that one can achieve about 18% reduction in the number of measurements needed by a robot to make the same inferences by more precisely modeling its light sensor.This paper demonstrates how a machine learning system that employs Bayesian inference (and inquiry) relies on the likelihood function of the data given the hypothesized model parameters. Rather than simply representing a noise model, the likelihood function quantifies the probability that a hypothesized situation could have given rise to the recorded data. By incorporating more information about the sensors (or equipment) used to record the data, one naturally is incorporating this information into the posterior probability, which results in one’s inferences.This is made even more apparent by a careful study of the experimental design problem that this particular robotic system is designed to explore. For example, it is easy to show that by using the naïve light sensor model, the entropy distribution for a proposed measurement location depends solely on the number of sampled circles for which the location is in the interior of the circle and the number of sampled circles for which the location is exterior to the circle. Given that we represented the posterior probability by sampling 50 circles, the maximum entropy occurs when the proposed measurement location is inside 25 circles (and outside 25 circles). As the robot’s parameter estimates converge, one can show that the system is simply performing a binary search by asking “yes” or “no” questions, which implies that each measurement results in one bit of information. However, in the case where the robot employs an SSF model of the light sensor, the question the robot is essentially asking is more detailed: “to what degree does the circle overlap the light sensor’s SSF?” The answer to such a question tends to provide more information, which significantly improves system performance. One can estimate the information gain achieved by employing the SSF model. Consider that the naive model reveals that estimating the circle’s position and radius with a precision of 4 mm given the prior information about the circle and the playing field requires 25 bits of information. The experiment using the SSF model requires on average 11.6 measurements, which implies that on average each measurement obtained using the SSF model provides about 25/11.6 = 2.15 bits of information. One must keep in mind, however, that this is due to the fact that the SSF model is being used not only to infer the circle parameters from the data, but also to select the measurement locations.Because the method presented here is based on a very general inferential framework, these methods can easily be applied to other types of sensors and equipment in a wide variety of situations. If one has designed a robotic machine learning system to rely on likelihood functions, then sensor models can be incorporated in more or less a plug-and-play fashion. This not only promises to improve the quality of robotic systems forced to rely on lower quality sensors, but it also opens the possibility for calibration on the fly by updating sensor models as data are continually collected.



---

*Source: 481054-2013-07-17.xml*