Two measurements can be individually useful for predicting an outcome and still provide almost the same information. A model that includes both may gain less than one that combines either measurement with a different source of information.

This makes feature selection an interesting optimization problem. The value of a feature depends partly on the other features selected alongside it. A list of individually ranked candidates cannot, by itself, capture that relationship.

A quadratic model of relevance and redundancy

Suppose we have a set of candidate features fi and a target variable y. Define ri as a measure of the relevance of feature i to the target. Let dij measure redundancy between features i and j. Both can be estimated using mutual information, which describes statistical dependence. Other relevance and redundancy measures may be appropriate for a particular task.

Let xi equal one when feature i is selected. A simple model minimizes

E(x) = −α ∑i ri xi + (1 − α) ∑i<jdijxixj,

subject to ∑ xi = k, with α between zero and one. The first term rewards relevant features. The second discourages selecting features that convey overlapping information. The cardinality condition specifies how many features to use.

The relative scales of r and d matter. A redundancy sum contains many more terms as the number of selected features grows. When choosing α, consider the selected cardinality and how the estimates have been normalized. The weight expresses the trade-off in this particular formulation rather than a universal definition of relevance.

Why a greedy decision may be insufficient

Consider four hypothetical features. The first is slightly more relevant than the second and third when examined individually, but has a high assigned redundancy score with both. The second and third convey more distinct information from one another. We want to select two features.

The worked example below assigns illustrative relevance and redundancy scores. It compares a greedy method that starts with the most relevant feature and adds the best remaining feature on the same quadratic objective, against enumeration of every two-feature subset.

Illustration: standalone Python calculation.

from itertools import combinations
r=[10,9,9,1]
d={(0,1):9,(0,2):9,(0,3):0,(1,2):0,(1,3):0,(2,3):0}
alpha=0.5

def energy(p):
    return -alpha*sum(r[i] for i in p)+(1-alpha)*sum(d[i,j] for i,j in combinations(sorted(p),2))
first=max(range(len(r)),key=lambda i:r[i])
greedy=min((tuple(sorted((first,i))) for i in range(len(r)) if i!=first),key=energy)
opt=min(combinations(range(len(r)),2),key=energy)
print('greedy',greedy,energy(greedy),'minimum',opt,energy(opt))
assert opt==(1,2) and energy(opt)<energy(greedy)

The example prints:

greedy (0, 3) -5.5 minimum (1, 2) -9.0

The globally minimum-energy pair differs from the pair selected by that particular greedy procedure. The example is intentionally small so that we can check the result by enumeration. It illustrates the reason to optimize the subset jointly: the value of one decision depends on another.

From a good objective to a good predictive model

The chosen features optimize the stated relevance-redundancy objective. Their usefulness in a predictive model is a separate question. Mutual information estimates depend on the data, the estimator and the sample size. Pairwise redundancy also cannot represent every higher-order interaction among features.

For a machine learning experiment, estimate feature relevance and redundancy using training data only. If parameters such as α or k are chosen by validation, perform the feature-selection procedure inside the training portion of each fold. Keep a separate test set for the final assessment. Otherwise, information from the evaluation data can influence which features are selected and make the reported performance misleading.

Compare the selected objective against enumeration on small instances and against suitable reference selection methods on larger ones. Evaluate downstream predictive performance, stability and the cost of collecting the chosen measurements separately. In sensitive applications, examine whether features are appropriate for the task and assess fairness with suitable domain-specific methods.

Using the model

The formulation is a binary quadratic objective with one explicit cardinality constraint. It is a natural example for the 4colors Optimizer for QUBO. By varying the cardinality or the relevance-redundancy trade-off, you can study the subsets the model selects and assess them within your own validation workflow.

Further reading

S. Mücke and colleagues, Feature selection on quantum computers.