## The redundancy of view-redundancy for co-training

Blum and Mitchell’s *co-training* is a (very deservedly) popular semi-supervised learning algorithm that relies on class-conditional feature independence, and view-redundancy (or view-agreement) for semi-supervised learning.

I will argue that the view-redundancy assumption is unnecessary, and along the way show how surrogate learning can be plugged into co-training (which is not all that surprising considering that both are multi-view semi-sup algorithms that rely on class-conditional view-independence).

I’ll first explain co-training with an example.

** Co-training – The setup**

Consider a classification problem on the feature space . I.e., a feature vector can be split into two as .

We make the rather restrictive assumption that and are class-conditionally independent for both classes. I.e., for .

(Note that unlike surrogate learning with mean-independence, both and are allowed to be multi-dimensional.)

Co-training makes an additional assumption that either view is sufficient for classification. This *view-redundancy* assumption basically states that the probability mass in the region of the feature space, where the Bayes optimal classifiers on the two views disagree with each other, is zero.

(The original co-training paper actually relaxes this assumption in the epilogue, but it is unnecessary to begin with, and the assumption has proliferated in later manifestations of co-training.)

We are given some labeled data (or a weak classifier on one of the views) and an large supply of unlabeled data. We are now ready to proceed with co-training to construct a Bayes optimal classifier.

**Co-training – The algorithm**

The algorithm is very simple. We use our weak classifier, say , (which we were given, or which we constructed using the measly labeled data) on the one view () to classify all the unlabeled data. We select the examples classified with high confidence, and use these as labeled examples (using the labels assigned by the weak classifier) to train a classifier on the other view ().

We now classify the unlabeled data with to similarly generate labeled data to retrain . This back-and-forth procedure is repeated until exhaustion.

Under the above assumptions (and with “sufficient” unlabeled data) and converge to the Bayes optimal classifiers on the respective feature views. Since either view is enough for classification, we just pick one of the classifiers and release it into the wild.

**Co-training – Why does it work?**

I’ll try to present an intuitive explanation of co-training using the example depicted in the following figure. Please focus on it intently.

The feature vector in the example is 2-dimensional and both views and are 1-dimensional. The class-conditional distributions are uncorrelated and jointly Gaussian (which means independent) and depicted by their equiprobability contours in the figure. The marginal class-conditional distributions are show along the two axes. Class is shown in red and class is shown in blue. The picture also shows some unlabeled examples.

Assume we have a weak classifier on the first view. If we extend the classification boundary for this classifier to the entire space , the boundary necessarily comprises of lines parallel to the axis. Let’s say there is only one such line and all the examples below that line are assigned class and all the examples above are assigned class .

We now ignore all the examples close to the classification boundary of (i.e., all the examples in the grey band) and project the rest of the points onto the axis.

How will these projected points be distributed along ?

Since the examples that were ignored (in the grey band) were selected based on their values, owing to class-conditional independence, the marginal distribution along for either class will be *exactly* the same as if none of the samples were ignored. This is the key reason for the conditional-independence assumption.

The procedure has two subtle, but largely innocuous, consequences.

First, since we don’t know how many class and class examples are in the grey band the relative ratio of the examples of the two classes in the not-ignored set may not the same as in the original full unlabeled sample set. If the class priors are known, this can easily be corrected for when we learn . If the class priors are unknown other assumptions on are necessary.

Second, when we project the unlabeled examples on to we assign them the labels given to them by which can be erroneous. In the figure above, there will be examples in the region indicated by A that are actually class but have been assigned class , and examples in region B that were from class but were called class .

Again because of the class-conditional independence assumption these erroneously labeled examples will be distributed according to the marginal class-conditional distributions. I.e., in the figure above we imagine, along the axis, a very low amplitude blue distribution with the same shape and location as the red distribution, and a very low amplitude red distribution with the same shape under the blue distribution. (Note . This is the noise in the original co-training paper.)

This amounts to having a labeled training set with label errors but with errors being generated *independently* of the location in the space. That is the number of errors in a region in the space is proportional to the number of examples in that region. These proportionally distributed errors are then washed out by the correctly labeled examples when we learn .

To recap, co-training works because of the following fact. Starting from a weak classifier on , we can generate very accurate and *unbiased* training data to train a classifier on .

**No need for view-redundancy**

Notice that, in the above example, we made no appeal to any kind of view-redundancy (other than whatever we may get gratis from the independence assumption).

The vigilant reader may however level the following two objections against the above argument-by-example.

1. We build and separately. So when the training is done, without view redundancy, we have not shown a way to pick from the two to apply to new test data.

2. At every iteration we need to select unlabeled samples that were classified with *high*-confidence by to feed to the trainer for . Without view-redundancy may be *none* of the samples will be classified with high confidence.

The first objection is easy to respond to. We pick neither nor for new test data. Instead we combine them to obtain a classifier . This is well justified because, under class-conditional independence, .

We react to the second objection by dropping the requirement of classifying with high-confidence altogether.

**Dropping the high-confidence requirement by surrogate learning**

Instead of training with examples that are classified with high confidence by , we train with all the examples (using the scores assigned to them by ).

At some iteration of co-training, define the random variable . Since and are class-conditionally independent, and are also class-conditionally independent. In particular is class-conditionally *mean-independent* of . Furthermore if is even a weakly useful classifier, barring pathologies, it will satisfy .

We can therefore apply surrogate learning under mean-independence to learn the classifier on . (This is essentially the same idea as Co-EM, which was introduced without much theoretical justification.)

**Discussion**

Hopefully the above argument has convinced the reader that the class-conditional view independence assumption obviates the view-redundancy requirement.

A natural question to ask is whether the reverse is true. That is, if we are given view-redundancy, can we completely eliminate the requirement of class-conditional independence? We can immediately see that the answer is no.

For example, we can duplicate all the features for any classification problem so that view-redundancy holds trivially between the two replicates. Moreover, the second replicate will be statistically fully dependent on the first.

Now if we are given a weak classifier on the first view (or replicate) and try to use its predictions on an unlabeled data set to obtain training data for the second, it would be equivalent to feeding back the predictions of a classifier to retrain itself (because the two views are duplicates of one another).

This type of procedure (which is an idea decades old) has been called, among other things, self-learning, self-correction, self-training and decision-directed adaptation. The problem with these approaches is that the training set so generated is *biased* and other assumptions are necessary for the feedback procedure to improve over the original classifier.

Of course this does not mean that the complete statistical independence assumption cannot be relaxed. The above argument only shows that at least *some amount* of independence is necessary.

## An effective kernelization of logistic regression

I will present a sparse kernelization of logistic regression where the prototypes are not necessarily from the training data.

**Traditional sparse kernel logistic regression**

Consider an class logistic regression model given by

for

where indexes the features.

Fitting the model to a data set involves estimating the betas to maximize the likelihood of .

The above logistic regression model is quite simple (because the classifier is a linear function of the features of the example), and in some circumstances we might want a classifier that can produce a more complex decision boundary. One way to achieve this is by *kernelization*. We write

for .

where is a kernel function.

In order to be able to use this classifier at run-time we have to store all the training feature vectors as part of the model because we need to compute the kernel value of the test example to every one of them. This would be highly inefficient, not to mention the severe over-fitting of the model to the training data.

The solution to both the test time efficiency and the over-fitting problems is to enforce *sparsity*. That is we somehow make sure that for all but a few examples from the training data. The import vector machine does this by greedily picking some examples so that the reduced example model best approximates the full model.

** Sparsification by randomized prototype selection**

The sparsified kernel logistic regression therefore looks like

for .

where the feature vectors are from the training data set. We can see that all we are doing is a vanilla logistic regression on a transformed feature space. The original dimensional feature vector has been transformed into an dimensional vector, where each dimension measures the kernel value of our test example to a prototype vector (or reference vector) .

What happens if we just selected these prototypes *randomly *instead of greedily as in the import vector machine?

Avrim Blum showed that if the training data distribution is such that the two classes can be linearly separated with a margin in the feature space induced by kernel function, then the classes can be, with high probability, linearly separated with margin with low error, in the transformed feature space if we pick a sufficient number of prototypes *randomly*.

That’s a mouthful, but basically we can use Blum’s method for kernelizing logistic regression as follows. Just pick random vectors from your dataset (in fact they need not be labeled), compute the kernel value of an example to these points and use these as features to describe the example. We can then learn a straightforward logistic regression model on this dimensional feature space.

As Blum notes, need not even be a valid kernel for using this method. Any reasonable similarity function would work, except the above theoretical guarantee doesn’t hold.

**Going a step further — Learning the reference vectors**

A key point to note is that there is no reason for the prototypes to be part of the training data. Any reasonable reference points in the original feature space would work. We just need to pick them so as to enable the resulting classifier to separate the classes well.

Therefore I propose kernelizing logistic regression by maximizing the log-likelihood with respect to the betas* as well as *the reference points. We can do this by gradient descent starting from a random points from our data set. The requirement is that the kernel function be differentiable with respect to the reference point . (Note. Learning vector quantization is a somewhat related idea.)

Because of obvious symmetries, the log-likelihood function is non-convex with respect to the reference vectors, but the local optima close to the randomly selected reference points are no worse than than the random reference points themselves.

**The gradient with respect to a reference vector**

Let us derive the gradient of the log-likelihood function with respect to a reference vector. First let us denote , i.e., the kernel value of the feature vector with the prototype by .

The log-likelihood of the data is given by

where is the usual indicator function. The gradient of with respect to the parameters can be found in any textbook on logistic regression. The derivative of with respect to the reference vector is

Putting it all together we have

That’s it. We can update all the reference vectors in the direction given by the above gradient by an amount that is controlled by the learning rate.

**Checking our sums**

Let us check what happens if there is only one reference vector and . That is, we use a linear kernel. We have

and therefore

which is very similar to the gradient of with respect to parameter. This is reasonable because with a linear kernel we are essentially learning a logistic regression classifier on the original feature space, where takes the place of .

If our kernel is the Gaussian radial basis function we have

**Learning the kernel parameters**

Of course gradient descent can be used to update the parameters of the kernel as well. For example we can initialize the parameter of the Gaussian r.b.f. kernel to a reasonable value and optimize it to maximize the log-likelihood as well. The expression for the gradient with respect to the kernel parameter is

**Going online**

The optimization of the reference vectors can be done in an online fashion by stochastic gradient descent ala Bob Carpenter.

Is it better to update all the parameters of the model (betas, reference vectors, kernel parameters) at the same time or wait for one set (say the betas) to converge before updating the next set (reference vectors)?

**Miscellany**

1. Since conditional random fields are just generalized logistic regression classifiers, we can use the same approach to kernelize them. Even if the all the features are binary, the reference vectors can be allowed to be continuous.

2. My colleague Ken Williams suggests keeping the model small by sparsifying the reference vectors themselves. The reference vectors can be encouraged to be sparse by imposing a Laplacian L1 prior.

3. The complexity of the resulting classifier can be controlled by the choice of the kernel and the number of reference vectors. I don’t have a good intuition about the effect of the two choices. For a linear kernel it seems obvious that any number of reference points should lead to the same classifier. What happens with a fixed degree polynomial kernel as the number of reference points increases?

4. Since the reference points can be moved around in the feature space, it seems extravagant to learn the betas as well. What happens when we fix the betas to random values uniformly distributed in [-1,1] and just learn the reference vectors? For what kernels do we obtain the same model as if we learned the betas as well?

5. I wonder if a similar thing can be done for support vector machines where a user specifies the kernel and the number of support vectors and the learning algorithm picks the required number of support vectors (not necessarily from the data set) such that the margin (on the training data) is maximized.

6. Ken pointed me to Archetypes, which is another related idea. In archetypal analysis the problem is to find a specified number of archetypes (reference vectors) such that all the points the data set can be as closely approximated by convex sums of the archetypes as possible. Does not directly relate to classification.

## A surrogate learning mystery

I’ll present an application of the surrogate learning idea in the previous post. It is mildly surprising at first blush, which I’ll contrive to make more mysterious.

**Murders she induced**

For readers who appreciate this sort of a thing, here’s the grandmother of all murder mysteries. In this one Miss Marple solves a whole bunch of unrelated murders all at once.

Miss Marple having finally grown wise to the unreliability of feminine intuition in solving murder mysteries spent some time learning statistics. She then convinced one of her flat-footed friends at the Scotland Yard to give her the files on all the unsolved murders, that were just sitting around gathering dust and waiting for someone with her imagination and statistical wiles.

She came home with the massive pile of papers and sat down to study them.

The file on each murder carefully listed all the suspects, with their possible motives, their accessibility to the murder weapon, psychological characteristics, previous convictions and many other details. There was a large variety in the number of suspects for different murders.

Furthermore, for every case the investigating officer made a note that the murderer was very likely to be part of the suspect pool. Only, it was not possible to narrow down the pool to one, and none of the suspects confessed.

Thinking statistically, Miss Marple decided to encode the characteristics of each suspect by a feature vector. Drawing on her vast experience in these matters she assigned numeric values to features like motives, psychology, relationship to the victim and access to the weapon.

All that was left was to build a statistical model that predicted the probability of a suspect being the murderer from his feature vector. She would then rank all the suspects of a case by this probability, and then she can have Scotland Yard try to get the most likely suspect to confess.

At this point Miss Marple paused for a moment to rue her oversight in not asking for the files on the solved murders as well. She could have used the suspects (and the known murderer) from the solved murders as labeled examples to train her statistical model. However, she soon realized …

I know you are tense with anticipation of the inevitable twist in the tale. Here it is.

*… she soon realized that she could build her model by training a regressor to predict, from the feature vector of a suspect, the size of the suspect pool he belongs to.*

**The clues**

Let’s re-examine the pertinent facts — 1. every suspect pool contains the murderer, 2. the suspect pools are of varying sizes.

The one, perhaps controversial, assumption we’ll need to make is that the feature vectors for both the murderers and the non-murderers are mean-independent of the size of the suspect pool they come from. (However, if it is good enough for Miss Marple, it is good enough for me.)

In any case, the violation of this assumption would imply that, when whether or not a suspect is a murderer is known, knowing his feature vector allows us to better predict the size of the suspect pool he belongs to. Because this is far-fetched, we can believe that the assumption is true.

In fact it may seem that knowing whether or not a suspect is murderer itself adds nothing to the predictability of the size of the pool from which the suspect is drawn. We will however show that the means for the murderers and non-murderers is different.

Let us now see why Miss Marple’s method works.

**Marple math**

Let the suspect pools be denoted with sizes . Let each suspect be described by the feature vector denoted . We now define the class label if a particular suspect is a murderer and otherwise.

We append the feature to the feature vector of a suspect from pool . That is, the surrogate feature we use is the negative of the pool size. (The negative is for a technical reason to match the previous post. In practice I would recommend , but this makes the argument below a bit more involved.)

The first thing to note is that the assumption we made above translates to for both and .

All we need to show is that and we are home free, because the argument in the previous post implies that can be used to rank suspects in a pool just as well as .

So all we need to do is to build a regressor to predict from the feature vector and apply this regressor to the of all the suspects in each pool and rank them by its output.

So why is ?

First it is clear that (where is the random variable describing the size of the suspect pool) because for each pool there is one murderer and we assign the negative of that pool size as for that murderer.

Now there are a total of non-murderers. For the non-murderers from the pool the assigned is . Therefore the estimated expected value is

If we divide through by and let the number of pools go to infinity, the estimate converges to the true mean, which is

It is easy to show that this quantity is always lower than if the variance of is non-zero (and if ), which we were given by the fact that the pool sizes are variable across murders.

And there you have it.

**A less criminal example**

Let me try to demystify the approach even more.

Assume that we have a database of images of faces of people along with their last names. Now the problem is the following — for a given face-name input pair to find the matching face and name in the database. Of course if all the names are unique this is trivial, but there are some common names like Smith and Lee.

Let us say that our procedure for this matching is to first obtain from the database the face images of the people with the same last name as the input, and then using our state-of-the-art face image comparison features to decide which of those is the right one. Do we need a training set of human-annotated input-database record pairs to train such a ranker? The above discussion suggests not.

Let us say we create a “fake” training set from a lot of unlabeled input image-name pairs by getting the set of records from the database with the matching name and assigning each feature vector a label which is the reciprocal of the size of the set. We then learn to predict this label from the image features.

The reason we would expect this predictor to behave similarly to the predictor of image match is that we can view our fake labeling as a probabilistic labeling of the feature vectors. For a given set our label is the a priori probability of a face image being the right match to the input image.

The independence assumption just makes sure that our probabilistic labeling is not biased.

I am curious about other possible applications.

## Surrogate learning with mean independence

In this paper we showed that if we had a feature that was class-conditionally statistically independent of the rest of the features, denoted , learning a classifier between the two classes and can be transformed into learning a predictor of from and another of from . Since the first predictor can be learned on unlabeled examples and the second is a classifier on a 1-D space, the learning problem becomes easy. In a sense acts as a *surrogate *for .

Similar ideas can be found in Ando and Zhang ’07, Quadrianto et. al. ’08, Blitzer et. al. ’06, and others.

**Derivation from mean-independence**

I’ll now derive a similar surrogate learning algorithm from *mean independence *rather than full statistical independence. Recall that the random variable is mean-independent of the r.v. if . Albeit weaker than full independence, mean-independence is still a pretty strong assumption. In particular it is stronger than the lack of correlation.

We assume that the feature space contains the single feature and the rest of the features . We are still in a two-class situation, i.e., . We further assume

1. is at least somewhat useful for classification, or in other words, .

2. is class-conditionally mean-independent of , i.e., for .

Now let us consider the quantity . We have

Notice that is a convex sum of and .

Now using the fact that we can show after some algebra that

We have succeeded in decoupling and on the right hand side, which results in a simple semi-supervised classification method. We just need the class-conditional means of and a regressor (which can be learned on unlabeled data) to compute . Again acting as a surrogate for is predicted from .

As opposed to the formulation in the paper this formulation easily accommodates continuous valued .

**Discussion**

1. The first thing to note is that we are only able to write an expression for but not . That is, we are able to weaken the independence to mean-independence at the expense of “wasting” feature .

Of course if we have full statistical independence we can use , by using Equation (1) and the fact that, under independence, we have

.

2. If (without loss of generality) we assume that , because lies somewhere between and , Equation (1) says that is a monotonically increasing function of .

This means that itself can be used as the classifier, and labeled examples are needed only to determine a threshold for trading off precision vs. recall. The classifier (or perhaps we should call it a ranker) therefore is built *entirely* from unlabeled samples.

I’ll post a neat little application of this method soon.

## Online logistic regression

I like Bob Carpenter’s paper — “Lazy sparse online logistic regression …“. In addition to being a nice overview of logistic regression, it describes online training for logistic regression by stochastic gradient descent under various parameter priors.

Another cool feature is that if the feature dimensionality is large but the examples are sparse, only the parameters corresponding to the features that are non-zero (for the current example) need to be updated (this is the lazy part). It is super easy to implement (a few hundred lines in C, for an svm_light like stand-alone application) and trains very fast, as attested to by Leon Bottou.

There is one issue about the regularization discount in a truly online setting where there is no “end of epoch”, which was discussed by Carpenter. He suggests leaving it at a constant, which, as he points out, corresponds to steadily decreasing the variance of the prior with the number of examples.

In my implementation I used 1/(N_INIT+NumExamplesSeenThusFar), where N_INIT is some constant (say 100). The effect of this is that as the dataset becomes large the prior is ignored, as it should be. However, the earlier examples contribute less to the parameter estimates than later ones.

To allow for better representation capability with sufficient data, I implemented the polynomial degree 2 kernel by an explicit higher dimensional feature map. This is either cumbersome or impossible for other kernels. I will discuss a more general kernelization of the method in a later post.

(Update April 04 2010. Some slides for a basic tutorial on logistic regression, online learning, kernelization and sequence classification.)

## Estimation of a distribution from i.i.d. sums

Here’s an estimation problem that I ran into not long ago while working on a problem in entity co-reference resolution in natural language documents.

Let be a random variable taking on values in . We are given data , where is the sum of independent draws of for . We are required to estimate the distribution of from .

For some distributions of we can use the method-of-moments. For example if , we know that the mean of is . We can therefore estimate as the sample mean, i.e., . Because of the nice additive property of the parameters for sums of i.i.d. poisson random variables, the maximum likelihood estimate also turns out be the same as .

The problem becomes more difficult when is say a six-sided die (i.e., the sample space is ) and we would like to estimate the probability of the faces . How can one obtain the maximum likelihood estimate in such a case?

## Probability density estimation as classification

Perhaps it has always been obvious to exalted statistical minds that density estimation can be viewed as classification and (perhaps) done using a classifier.

Assume that we have samples of a random vector whose distribution has bounded support. In fact, without loss of generality, let the support be the unit hypercube . We are required to estimate the density of .

Now assume that we generate a bunch of samples uniformly distributed in . We assign a label to all the samples and a label to all and a build a classifier between the two sample sets. In other words we construct an estimate of the posterior class probability .

Now, we know that

where , the uniform distribution over the unit hypercube. The above equation can be solved for to obtain an estimate

Because is in our control, ideally we would like to obtain

The question is, because we know the distribution of the samples for class 0 (uniform!), for any particular classifier (say the Gaussian process classifier or logistic regression) can the limit be computed/approximated without actually sampling and then learning?

This paper (which I haven’t yet read) may be related.

Update Aug 24, 2009. The uniform distribution can be substituted by any other proposal distribution from which we can draw samples and which has a support that includes the support of the density we wish to estimate. George, thanks for pointing this out.