# Surprise Measure

**Abstract**

Learning is the process of *acquiring knowledge*. In psychology, learning is defined as the *modification of behavior* through training. In this work, we define learning as the modification of a system model to incorporate the knowledge acquired by new observations. During learning, a system creates and modifies its model to improve performance. As new samples are introduced, the system updates its model based on the new information provided by the samples. However, this update may not necessarily improve the model.

A Bayesian surprise metric was proposed to differentiate good data (beneficial) from outliers (detrimental), and thus help to *selectively* adapt the model parameters. The surprise metric is calculated based on the difference between the prior and the posterior distributions of the model when a new sample is introduced. The metric is useful not only to identify outlier data, but also to differentiate between the data carrying useful information for improving the model and those carrying no new information (redundant). Allowing only the relevant data to update the model would speed up the learning process and prevent the system from overfitting.

**Relation to Information Theory**

A quantitative definition of the relevance a new observation has to the system is required to subjectively measure the information available in the observation based on the current system knowledge.

The information content of an outcome , whose probability is , is defined as . For a random variable (r.v.) , the average information content is defined as , which is also called Shannon’s entropy of r.v. .

To account for the subjective information which the outcome brings to a system with its own subjective belief, we need to consider its subjective probability . The subjective information content of outcome to the system with subjective probability is then defined as . The average subjective information, , is given by the expectation value of the subjective information, , taken with the true probabilities as .

Since measures the uncertainty of a system that does not know the correct probabilities, it should be larger than the uncertainty of an ideal observer that knows the true probabilities. Thus, we can state that , with equality being true only when the system has full knowledge of its environment. The difference between and defined as:

,

represents the information that the system is missing from the data and that can be learned by adjusting the subjective probabilities closer to the true probabilities. This is called the *information gain* and is the basis for surprise as it measures the system’s ignorance. This can be understood from the fact that is nonnegative and vanishes if and only if and coincide (Kullback-Leibler divergence).

**Surprise Metric**

Surprise is a *subjective information measure* that quantifies how much information a new observation contains in relation to the current knowledge of the system. It exists only in the presence of uncertainty and is related to the expectations of the system, where the same data carries different amount of surprise to different systems or to the same system at different times.

To quantify the surprise factor of an observation, we measure the amount of information gained by a model from the introduction of a new observation. We compare the probability of a model given a new data observation , , against its prior over all models [1]. The surprise factor is measured using the information gain as:

.

Since Kullback-Leibler divergence, , does not yield an analytic closed-form expression, we use a different divergence measure, the Cauchy-Schwarz divergence [2], whose closed-form solution is easily computed. is derived from the Cauchy-Schwarz inequality , where the equality holds if and only if for a constant scalar . The Cauchy-Schwarz divergence measure of two PDFs is defined as:

.

is a symmetric measure and , where the equality holds if and only if . However, the triangle inequality property does not hold, so it cannot be considered as a metric. can be broken down and rewritten as , where the argument of the first term, , estimates the interactions on locations within the support of when exposed to the potential created by (or viceversa). This term is *Renyi’s quadratic cross entropy* and measures the similarity between the two PDFs. It can also be interpreted as the *information gain* from observing with respect to the “true” density and plays an important role in calculating surprise as it measures the amount of new information that is gained from the new observation. The other two terms are the negative Renyi’s quadratic entropies of the respective PDFs and are considered as normalizing terms. The surprise measure using Cauchy-Schwarz divergence is then defined as:

,

where is the quadratic Renyi’s cross-entropy, and are Renyi’s quadratic entropy of model prior and posterior distributions respectively.

In essence, surprise measures the change to the posterior distribution caused by the information on the new observation . If the posterior is the same as the prior, the observation carries no new information, thus leaving knowledge about the model unaffected. However, if the posterior significantly differs from the prior, the observation carries an element of surprise that can be used to either improve the model (reasonable difference) or significantly change it (drastic difference). We use the surprise value to categorize $x_n$ into one of three categories:

*Outlier*: , the observation will be discarded as unwanted/outlier.*Interesting*: , the observation contains useful information and should be used to update the current belief of the model .*Redundant*: , the observation lacks uncertainty and while it is included as a member of the model , posterior parameters are not updated. (As the number of observations increases, redundant samples become more likely, thus by electing not to update the parameters, overfitting is prevented.)

**Surprise behavior**

The figure below shows the surprise field of a model generated from a dataset whose samples are shown in blue dots. To measure the surprise factor of a new sample , the sample is included as part of the model and its parameters are recomputed (in this example, model is represented as a mixture of Gaussians).The surprise value of two data samples is also shown in the figure: a good data sample (S=0.0080), and an outlier (S=0.2166). As expected, the surprise factor for a good sample is very small compared to an outlier. The surprise field also reiterates this point and illustrates that as data samples move further away from the model data, their respective surprise values become larger.

The surprise factor depends on the system knowledge, and as the number of samples introduced to the system increases the surprise value decreases. This poses a challenge when utilizing surprise in clustering problems as each cluster has its own model and surprise depends on the state of the model. The two figures below illustrate the problem that we face in classification/clustering. Two clusters are represented in blue squares and red circles and the new sample is represented by a black star. By intuition, we would expect that the new sample should belong to the left cluster, however the surprise value of the cluster on the right is much smaller, 0.007 compared to 0.025 for the cluster on the left. This occurs because the surprise value decreases as the number of samples introduced to the system increases, and the right cluster model has observed more samples than the left cluster. This results in the surprise value of any sample, even an outlier in this case, to be smaller than that of the left cluster model. There are many ways to mitigate this depending on the problem you are solving and the model chosen for the system. A quick solution we used in this example was to normalize surprise by the high-threshold. The normalized surprise value provides a fair comparison among clusters where the surprise value for the left cluster is 2.125 and for the right cluster is 3.704.

**Experiments and Results**

We have utilized surprise on several clustering/classification and outlier detection problems.

Browse the links below to see the details and results of these tests:

- Popular synthetic datasets
- ONR project – contact fusion
- (more results coming soon)

**(to be continued)**

this work is currently under review, more information to follow.

**References**

- L. Itti and P. F. Baldi, “Bayesian surprise attracts human attention,” in Advances in Neural Information Processing Systems, Vol. 19 (NIPS2005).
- J. C. Principe, “Information Theoretic Learning, Renyi’s Entropy and Kernel Perspectives”. New York, NY: Springer, 2010.