# Patent

## Title
Contextual similarity measures for objects and retrieval, classification, and clustering using same

## Abstract

A method of comparing first and second objects in a context comprises: maximizing or minimizing a quantitative comparison of the first object and a mixture of the second object and the context respective to a weighting parameter that controls the mixture; and outputting a comparison value based on the value of the weighting parameter determined by the maximizing or minimizing.

## Background
BACKGROUND
The following relates to the information processing arts, information storage and retrieval arts, classification and clustering arts, and related arts.
The comparison of objects, such as vectors, is an important quantitative analysis operation for many applications, including but not limited to: vector analysis; image processing; document processing; data retrieval; clustering operations; classification operations; and so forth. Not surprisingly, there are a wide range of comparison operators available for comparing different objects. In one organizational scheme, comparison operators can be divided into similarity measures and distance or divergence measures. A similarity measure is characterized in that its value increases when comparing more similar objects, and has a largest value for identical or nearly identical objects. On the other hand, a distance or divergence measure is characterized in that its value increases with increasing difference, that is, increasing distance or divergence, between the objects, and has a zero or small value for identical or nearly identical objects.
For generality, the terms “comparison measure” or “comparison” or other similar phraseology is used herein to encompass both similarity measures and distance or divergence measures.
Existing comparison measures readily facilitate relative comparisons, for example determining whether object “A” is more similar to object “B” than to object “C”. However, this information does not inform as to whether objects “A” and “B” are actually comparable to each other. The answer to this latter question depends upon the “context” or “environment” or “setting”. For example, consider similarity between a dog and a bull and a fish. In the context of animals, a dog and a bull may be deemed to be quite similar—they are both mammals, both air-breathing, both have four legs, both are typically domesticated, and so forth, whereas the fish is more dissimilar in all these aspects and numerous others, and other animals such as an amoeba are still more dissimilar. However, in the context of four-legged domesticated mammals, the dog and the bull are rather dissimilar—the dog is carnivorous, likely to be a pet, has clawed feet, and so forth, whereas the bull is herbivorous, a farm animal, has hoofed feet, and so forth. In this context, a bull might be deemed to be dissimilar to dog, whereas an animal such as a cat might be deemed to be similar to a dog in the context of four-legged domesticated animals.
BRIEF DESCRIPTION
In some illustrative embodiments disclosed as illustrative examples herein, a storage medium stores instructions executable to compare first and second objects in a context by: maximizing or minimizing a comparison function respective to a weighting parameter, the comparison function including a quantitative comparison of the first object and a mixture of the second object and the context wherein the mixture is controlled by the weighting parameter; and outputting a comparison value that is equal to or determined based on a value of the weighting parameter obtained by the maximizing or minimizing.
In some illustrative embodiments disclosed as illustrative examples herein, a method of comparing first and second objects in a context is disclosed, the method comprising: maximizing or minimizing a quantitative comparison of the first object and a mixture of the second object and the context respective to a weighting parameter that controls the mixture; and outputting a comparison value based on the value of the weighting parameter determined by the maximizing or minimizing.
In some illustrative embodiments disclosed as illustrative examples herein, a quantitative contextual comparison module is disclosed, which is configured to perform the method set forth in the immediately preceding paragraph.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 diagrammatically shows an illustrative quantitative contextual comparison module.
FIG. 2 diagrammatically shows an illustrative image retrieval system employing the quantitative contextual comparison module of FIG. 1.



DETAILED DESCRIPTION
The previously described contextual comparison examples relating to dogs, cats, bulls, fish, and amoebas are readily qualitatively understood. However, qualitative understanding is not useful in quantitative analyses, or in information processing systems such as classifiers, information retrieval systems, clustering engines, or so forth. It is recognized herein that what is needed for such applications is quantitative contextual comparison.
With reference to FIG. 1, a first object 10, a second object 12, and a context 14 are each represented in a quantitative form, such as a discrete or continuous distribution, a vector, a sequence of vectors, or so forth. A quantitative contextual comparison module 20 computes a quantitative comparison value 22 that quantitatively indicates the similarity (or difference or divergence) between the first object 10 and the second object 12 relative to the similarity (or difference or divergence) between the first object 10 and the context 14. As shown herein, the seemingly complex operation of the quantitative contextual comparison module 20 can be implemented in a computationally efficient fashion using substantially any existing non-contextual comparison operator. In one example, a quantitative contextual similarity measure can be written as:

csƒ(q,p|u)=argmaxω{ƒ(q,ω·p+(1−ω)·u)},0≦ω≦1  (1).

In Equation (1), the quantitative representation of the first object 10 is denoted as q, the quantitative representation of the second object 12 is denoted as p, and the quantitative representation of the context 14 is denoted as u. The function ƒ(a,b) is a non-contextual similarity measure. As such, the function ƒ(a,b) has an increasingly larger value as the parameters a and b become increasingly more similar. The function arg maxω{ƒ(ω)} outputs the value of the parameter ω which maximizes the value of the argument ƒ(ω), under the constraint (in Equation (1)) that 0≦ω≦1. It follows that 0≦csƒ(q,p|u)≦1 under the constraint 0≦ω≦1 set forth in Equation (1). The function csƒ(q,p|u) is suitably read as “the contextual similarity of object q with respect to object p in the context u.”

To understand the operation of the contextual similarity measure set forth in Equation (1), it is useful to consider some limiting cases. If the first object q 10 and the second object p 12 are identical while there is some dissimilarity between the first object q 10 and the context u 14, then ƒ(q,p) generates the largest possible value for the non-contextual similarity measure ƒ. In Equation (1), the expression ƒ(q,p) is the argument of the arg maxω{ . . . } function when ω=1. It follows that for the limiting case in which the first object q 10 and the second object p 12 are identical (that is, q=p) while there is some dissimilarity between the first object q 10 and the context u 14, the contextual similarity csƒ(q,p|u)=1. (The converse does not necessarily hold—that is, csƒ(q,p|u)=1 does not necessarily imply that q=p.)
At the opposite limiting case, if the first object q 10 and the context u 14 are identical while there is some dissimilarity between the first object q 10 and the second object p 12, then ƒ(q,u) generates the largest possible value for the non-contextual similarity measure ƒ. In Equation (1), the expression ƒ(q,u) is the argument of the arg maxω{ . . . } function when ω=0. It follows that for the limiting case in which the first object q 10 and the context u 14 are identical while there is some dissimilarity between the first object q 10 and the second object p 12, the contextual similarity csƒ(q,p|u)=0.
For intermediate cases, the expression ω·p+(1−ω)·u defines a mixture of the second object p 12 and the context u 14, with the parameter ω serving as a weighting parameter that controls the mixture. For smaller values of ω the context u 14 dominates the mixture, whereas for larger values of ω the second object p 12 dominates the mixture. The arg maxω{ . . . } function outputs the value of the weighting parameter ω for which the mixture of the second object p 12 and the context u 14 is most similar to the first object q 10, as measured by the non-contextual similarity measure ƒ. The value of Equation (1) for p=u is ambiguous since in that case the value of csƒ does not depend upon ω—in some embodiments csƒ(q,p|u)=0.5 is assigned for p=u.
In Equation (1), the function ƒ is a similarity measure, and is paired with arg maxω{ . . . } in order to determine the mixture of the second object p 12 and the context u 14 that maximizes the similarity function. Alternatively, the function ƒ could be a difference or divergence measure, for which a smaller value indicates a higher degree of similarity. In such cases, the arg maxω{ . . . } function of Equation (1) is suitably replaced by an arg minω{ . . . } function in order to determine the mixture of the second object p 12 and the context u 14 that minimizes the difference or divergence measure. Although in such cases the non-contextual comparison measure ƒ is a difference or divergence measure, the output of the arg minω{ . . . } function (which is the value output by the contextual similarity measure csƒ assuming the bounding conditions 0≦ω≦1 are not encountered) is still a similarity value in which a larger value is indicative of greater similarity.
Alternatively, the quantitative contextual comparison module 20 can implement a difference or divergence measure, in which the output is larger to indicate greater dissimilarity of p and q in the context u. One way of formulating a contextual difference measure is as follows:

cdƒ(q,p|u)=1−csƒ(q,p|u)  (2),

where 0≦cdƒ(q,p|u)≦1 when 0≦csƒ(q,p|u)≦1. Here, strong similarity (that is, a small distance or divergence) between the first object q 10 and the second object p 12 relative to the context u 14 is indicated by cdƒ(q,p|u)≈0, while a very large distance between the first object q 10 and the second object p 12 relative to the context u 14 is indicated by a larger value for the contextual distance cdƒ(q,p|u).

Equations (1) and (2) represent two examples of quantitative contextual comparison operators. More generally, a quantitative contextual comparison operator can be implemented by maximizing or minimizing a comparison function respective to a weighting parameter and generating an output based on the value of the weighting parameter determined by the maximizing or minimizing, where the comparison function includes a quantitative comparison of the first object 10 and a mixture of the second object 12 and the context 14 and where the mixture is controlled by the weighting parameter. For linear mixtures, a suitable comparison function can be written as ƒ(q,ω·p+(1−ω)·u) or as ƒ(q,(1−ω)·p+ω·u), and is maximized or minimized respective to the weighting parameter represented as ω, where the first object is represented as q, the second object is represented as p, the context is represented as u, and the ƒ is a similarity, difference, or divergence measure. Optionally, the minimizing or maximizing is performed under a constraint on the allowable range of values that the weighting parameter may assume, such as the constraint 0≦ω≦1 that is included in illustrative Equation (1). Optionally, the comparison function can be symmetrized. For example, the contextual similarity measure of Equation (1), can be symmetrized as:




  
    
      
        
          
            
              scs
              f
            
            ⁡
            
              (
              
                q
                ,
                p
              
              )
            
          
          =
          
            
              argmax
              ω
            
            ⁢
            
              {
              
                
                  f
                  ⁡
                  
                    (
                    
                      q
                      ,
                      
                        
                          ω
                          ·
                          p
                        
                        +
                        
                          
                            (
                            
                              1
                              -
                              ω
                            
                            )
                          
                          ·
                          u
                        
                      
                    
                    )
                  
                
                +
                
                  f
                  ⁡
                  
                    (
                    
                      p
                      ,
                      
                        
                          ω
                          ·
                          q
                        
                        +
                        
                          
                            (
                            
                              1
                              -
                              ω
                            
                            )
                          
                          ·
                          u
                        
                      
                    
                    )
                  
                
              
              }
            
          
        
        ,
        
          

        
        ⁢
        
          
        
        ⁢
        
          0
          ≤
          ω
          ≤
          1.
        
      
    
    
      
        (
        3
        )
      
    
  




Another way of symmetrizing the contextual similarity measure of Equation (1) is to sum csƒ(q,p|u)+csƒ(p,q|u). In these examples, the comparison function is symmetrized by further including a quantitative comparison of the second object 12 and a second mixture, where the second mixture is of the first object 10 and the context 14 and is also controlled by the weighting parameter.

The disclosed quantitative contextual comparison measures can be viewed as contextualized versions of non-contextual similarity measures. Most known non-contextual comparison measures can serve as the comparison function that is maximized or minimized with respect to a weighting parameter and includes a quantitative comparison of the first object and a mixture of the second object and the context wherein the mixture is controlled by the weighting parameter. Accordingly, most non-contextual comparison measures can be contextualized as disclosed herein. To further demonstrate this point, some further illustrative examples follow.
In one embodiment, the non-contextual comparison measure is a Euclidean distance




  
    
      L
      ⁢
      
        
      
      ⁢
      2
      ⁢
      
        (
        
          x
          ,
          y
        
        )
      
    
    =
    
      
        ∑
        
          i
          =
          1
        
        D
      
      ⁢
      
        
      
      ⁢
      
        
          (
          
            
              x
              i
            
            -
            
              y
              i
            
          
          )
        
        2
      
    
  
  ,




where xi and yi denote respectively the i-th dimensions of vectors x and y and D is the dimensionality of the vectors. In such as case, Equation (1) can be written as:





  
    
      
        
          
            
              cs
              
                L
                ⁢
                
                  
                
                ⁢
                2
              
            
            ⁡
            
              (
              
                q
                ,
                
                  p
                  ❘
                  u
                
              
              )
            
          
          =
          
            arg
            ⁢
            
              
            
            ⁢
            
              
                min
                ω
              
              ⁢
              
                {
                
                  
                    ∑
                    
                      i
                      =
                      1
                    
                    D
                  
                  ⁢
                  
                    
                      [
                      
                        
                          q
                          i
                        
                        -
                        
                          (
                          
                            
                              ω
                              ·
                              
                                p
                                i
                              
                            
                            +
                            
                              
                                (
                                
                                  1
                                  -
                                  ω
                                
                                )
                              
                              ·
                              
                                u
                                i
                              
                            
                          
                          )
                        
                      
                      ]
                    
                    2
                  
                
                }
              
            
          
        
        ,
        
          

        
        ⁢
        
          0
          ≤
          ω
          ≤
          1.
        
      
    
    
      
        (
        4
        )
      
    
  




Because a distance measure is used in Equation (4), the arg maxω{ . . . } of Equation (1) is replaced by arg minω{ . . . } in Equation (4). The contextual comparison measure csL2 is still a similarity measure, even though the constituent non-contextual comparison measure is a distance measure. In other words, larger values for csL2 still indicate greater similarity. For quantities p,q,u that are multinomials of dimensionality D, Equation (4) can be solved in closed form by setting the derivative of the concave Euclidean distance





  
    ∑
    
      i
      =
      1
    
    D
  
  ⁢
  
    
      [
      
        
          q
          i
        
        -
        
          (
          
            
              ω
              ·
              
                p
                i
              
            
            +
            
              
                (
                
                  1
                  -
                  ω
                
                )
              
              ·
              
                u
                i
              
            
          
          )
        
      
      ]
    
    2
  




to zero, yielding:





  
    
      
        
          
            
              cs
              
                L
                ⁢
                
                  
                
                ⁢
                2
              
            
            ⁡
            
              (
              
                q
                ,
                
                  p
                  ❘
                  u
                
              
              )
            
          
          =
          
            
              
                ∑
                
                  i
                  =
                  1
                
                D
              
              ⁢
              
                
                  (
                  
                    
                      p
                      i
                    
                    -
                    
                      u
                      i
                    
                  
                  )
                
                ⁢
                
                  (
                  
                    
                      q
                      i
                    
                    -
                    
                      u
                      i
                    
                  
                  )
                
              
            
            
              
                ∑
                
                  i
                  =
                  1
                
                D
              
              ⁢
              
                
                  (
                  
                    
                      p
                      i
                    
                    -
                    
                      u
                      i
                    
                  
                  )
                
                2
              
            
          
        
        ,
        
          

        
        ⁢
        
          0
          ≤
          ω
          ≤
          1.
        
      
    
    
      
        (
        5
        )
      
    
  




When applying Equation (5), the constraint 0≦ω≦1 is enforced as follows. If the computed value of ω is less than zero, then csL2=0 is assigned. If the computed value of ω is greater than one, then csL2=1 is assigned. This contextual quantitative similarity measure formulation has a simple geometric interpretation: csL2 is proportional to the projection of the vector (q−u) onto the vector (p−u).

In another embodiment, the non-contextual comparison measure is a Manhattan distance L1, for which Equation (1) can be written as (in the case of quantities p,q,u that are multinomials of dimensionality D):




  
    
      
        
          
            
              cs
              
                L
                ⁢
                
                  
                
                ⁢
                1
              
            
            ⁡
            
              (
              
                q
                ,
                
                  p
                  ❘
                  u
                
              
              )
            
          
          =
          
            arg
            ⁢
            
              
            
            ⁢
            
              
                min
                ω
              
              ⁢
              
                {
                
                  
                    ∑
                    
                      i
                      =
                      1
                    
                    D
                  
                  ⁢
                  
                    
                    
                      
                        q
                        i
                      
                      -
                      
                        (
                        
                          
                            ω
                            ·
                            
                              p
                              i
                            
                          
                          +
                          
                            
                              (
                              
                                1
                                -
                                ω
                              
                              )
                            
                            ·
                            
                              u
                              i
                            
                          
                        
                        )
                      
                    
                    
                  
                
                }
              
            
          
        
        ,
        
          

        
        ⁢
        
          0
          ≤
          ω
          ≤
          1.
        
      
    
    
      
        (
        6
        )
      
    
  




The function csL1 is convex and piecewise linear. Thus, its minimum is reached at one of the values (qi−ui)/(pi−ui). The minimization of





  
    ∑
    
      i
      =
      1
    
    D
  
  ⁢
  
    
    
      
        q
        i
      
      -
      
        (
        
          
            ω
            ·
            
              p
              i
            
          
          +
          
            
              (
              
                1
                -
                ω
              
              )
            
            ·
            
              u
              i
            
          
        
        )
      
    
    
  




respective to ω can be performed as a weighted median problem which can be solved in O(D).

In another embodiment, the non-contextual comparison measure is a Kullback-Leibler (KL) divergence, for which Equation (1) can be written as (in the case of quantities p,q,u that are multinomials of dimensionality D):




  
    
      
        
          
            
              cs
              KL
            
            ⁡
            
              (
              
                q
                ,
                
                  p
                  ❘
                  u
                
              
              )
            
          
          =
          
            arg
            ⁢
            
              
            
            ⁢
            
              
                min
                ω
              
              ⁢
              
                {
                
                  
                    ∑
                    
                      i
                      =
                      1
                    
                    D
                  
                  ⁢
                  
                    
                      q
                      i
                    
                    ⁢
                    
                      log
                      ⁡
                      
                        (
                        
                          
                            q
                            i
                          
                          
                            
                              ω
                              ·
                              
                                p
                                i
                              
                            
                            +
                            
                              
                                (
                                
                                  1
                                  -
                                  ω
                                
                                )
                              
                              ·
                              
                                u
                                i
                              
                            
                          
                        
                        )
                      
                    
                  
                
                }
              
            
          
        
        ,
        
          

        
        ⁢
        
          0
          ≤
          ω
          ≤
          1.
        
      
    
    
      
        (
        7
        )
      
    
  




This objective function is similar to that of Probabilistic Latent Semantic Analysis (PLSA). See, for example, Hofmann, “Unsupervised learning by probabilistic latent semantic analysis”, Machine Learning vol. 42 pp. 177-96 (2001) which is incorporated herein by reference in its entirety. By analogy to PLSA, Equation (7) can be optimized iteratively using the expectation maximization (EM) algorithm. At iteration (k+1) the expectation (E) step yields:





  
    
      
        
          
            γ
            i
            
              (
              
                k
                +
                1
              
              )
            
          
          =
          
            
              
                ω
                
                  (
                  k
                  )
                
              
              ⁢
              
                p
                i
              
            
            
              
                
                  ω
                  
                    (
                    k
                    )
                  
                
                ⁢
                
                  p
                  i
                
              
              +
              
                
                  (
                  
                    1
                    -
                    
                      ω
                      
                        (
                        k
                        )
                      
                    
                  
                  )
                
                ·
                
                  u
                  i
                
              
            
          
        
        ,
      
    
    
      
        (
        8
        )
      
    
  




and the maximization (M) step yields:





  
    
      
        
          ω
          
            (
            
              k
              +
              1
            
            )
          
        
        =
        
          
            ∑
            
              i
              =
              1
            
            D
          
          ⁢
          
            
              q
              i
            
            ⁢
            
              
                γ
                i
                
                  (
                  
                    k
                    +
                    1
                  
                  )
                
              
              .
            
          
        
      
    
    
      
        (
        9
        )
      
    
  




However, the EM algorithm can be slow to converge. Accordingly, an alternative, faster optimization technique can optionally be employed to solve the arg minω{ . . . } minimization of Equation (7), such as gradient-descent type algorithms.

In another embodiment, the non-contextual comparison measure is a Bhattacharyya similarity measure, for which Equation (1) can be written as (in the case of quantities p,q,u that are multinomials of dimensionality D):




  
    
      
        
          
            
              cs
              bha
            
            ⁡
            
              (
              
                q
                ,
                
                  p
                  ❘
                  u
                
              
              )
            
          
          =
          
            arg
            ⁢
            
              
            
            ⁢
            
              
                max
                ω
              
              ⁢
              
                {
                
                  
                    ∑
                    
                      i
                      =
                      1
                    
                    D
                  
                  ⁢
                  
                    
                      q
                      i
                    
                    ·
                    
                      (
                      
                        
                          ω
                          ·
                          
                            p
                            i
                          
                        
                        +
                        
                          
                            (
                            
                              1
                              -
                              ω
                            
                            )
                          
                          ·
                          
                            u
                            i
                          
                        
                      
                      )
                    
                  
                
                }
              
            
          
        
        ,
        
          

        
        ⁢
        
          0
          ≤
          ω
          ≤
          1.
        
      
    
    
      
        (
        10
        )
      
    
  




In Equation (10), the arg maxω{ . . . } function is used because the non-contextual comparison measure is a similarity measure. The objective function that is maximized respective to ω by the arg maxω{ . . . } function in Equation (10) is advantageously concave, and can be optimized using gradient-based methods or other iterative optimization methods.

These are merely illustrative examples, and other non-contextual comparison measures can be used for the function ƒ, such as a Hellinger (HE) distance defined by




  
    ∑
    
      i
      =
      1
    
    D
  
  ⁢
  
    
      (
      
        
          
            p
            i
          
        
        -
        
          
            q
            i
          
        
      
      )
    
    2
  




or a chi-squared distance, both of which advantageously lead to convex objective functions when used in Equation (1) together with arg minω{ . . . }. The contextual similarity measure obtained by using the HE or chi-squared distance together arg minω{ . . . } is suitably solved using iterative gradient-based methods.

Two classes of non-contextual comparison measures that can be used in Equation (1) include the class of Bregman divergences and the class of Csizár divergences, both of which are advantageously typically convex in ω when used in Equation (1). The Bregman divergence between two distributions x and y both of which are belonging to the space of probabilities Ω for a convex function h:Ω→ is defined as: Bh(x,y)=h(x)−h(y)−∇h(y),(x−y) where ∇h denotes the gradient vector of h and  . . .  denotes a dot product. Intuitively, Bh(x,y) can be understood as the difference between the value of h at point x and the value of the first-order Taylor expansion of h around v evaluated at x. Members of the class of Bregman divergences include the Euclidean distance (discussed with reference to Equations (4) and (5)), the Mahalanobis distance, the KL divergence (discussed with reference to Equations (7)-(9)) and the Itakura-Saito divergence.
The Csizár divergence between two discrete distributions x and y for a convex function h:→ is given by:




  
    
      
        
          
            f
            h
          
          ⁡
          
            (
            
              x
              ,
              y
            
            )
          
        
        =
        
          
            ∑
            i
            
              
            
          
          ⁢
          
            
              x
              i
            
            ×
            
              
                h
                ⁡
                
                  (
                  
                    
                      y
                      i
                    
                    
                      x
                      i
                    
                  
                  )
                
              
              .
            
          
        
      
    
    
      
        (
        11
        )
      
    
  




Members of the class of Csizár divergences include the Manhattan distance (discussed with reference to Equation (6)), the KL divergence (discussed with reference to Equations (7)-(9)), the Hellinger (HE) divergence, and the Rényi divergence.

As used herein, the terms “minimizing”, “maximizing”, and the like are to be understood as calling for finding a value of the function or expression that is at least sufficiently small or sufficiently large for an intended purpose or for an intended analysis. In some embodiments, “minimizing” or “maximizing” may be performed by identifying the global minimum or global maximum, for example as results by evaluating a closed-form expression for the minimum or maximum.
In some embodiments, “minimizing” or “maximizing” may be performed by an iterative process that is terminated when a stopping criterion is met, such as a change in the value of the function from one iteration to the next falling below a threshold, or a change in the value of the parameter that is adjusted during optimization (that is, the weighting parameter ω in the case of maximizing the argument of arg maxω{ . . . } in Equation (1)), or so forth. In such embodiments, the obtained minimum or maximum may be slightly higher than or lower than the global minimum or maximum, respectively.
In yet other embodiments, minimizing or maximizing may be used for the intended purpose or intended analysis of determining whether the similarity (or difference) is greater than (or less than) a threshold value. Taking the use of similarity for retrieval as an illustrative example, it may be desired to determine where the first and second objects 10, 12 in the context 14 are more similar than a threshold similarity value. The first object 10 is retrieved if the first and second objects 10, 12 in the context 14 are more similar than the threshold similarity value, and is not retrieved otherwise.
In some such “thresholding” embodiments, evaluation of the arg maxω{ . . . } or arg minω{ . . . } function may be expedited based on the knowledge that the output generated based on the maximizing or minimizing is the binary decision of whether the threshold criterion is met. For example, if the argument of arg maxω{ . . . } or arg minω{ . . . } is differentiable at the threshold which is denoted herein as θ, and if the argument of arg maxω{ . . . } or arg minω{ . . . } is concave in ω (for arg maxω{ . . . }) or convex in ω (for arg minω{ . . . }), then there exists the equivalence (for the arg maxω{ . . . } embodiment as in Equation (1); the arg minω{ . . . } analysis is analogous):




  
    
      
        
          arg
          ⁢
          
            
          
          ⁢
          
            
              max
              ω
            
            ⁢
            
              {
              
                f
                ⁡
                
                  (
                  
                    q
                    ,
                    
                      
                        ω
                        ·
                        p
                      
                      +
                      
                        
                          (
                          
                            1
                            -
                            ω
                          
                          )
                        
                        ·
                        u
                      
                    
                  
                  )
                
              
              }
            
          
        
        ≥
        
          
            
               
              
                θ
                ⇔
                
                  
                    ∂
                    
                      
                    
                  
                  
                    ∂
                    ω
                  
                
              
              
            
            
              ω
              =
              0
            
          
          ⁢
          
            f
            ⁡
            
              (
              
                q
                ,
                
                  
                    ω
                    ·
                    p
                  
                  +
                  
                    
                      (
                      
                        1
                        -
                        ω
                      
                      )
                    
                    ·
                    u
                  
                
              
              )
            
          
        
        ≥
        0
      
    
    
      
        (
        12
        )
      
    
  




An advantage of the gradient-based expression of the right-hand side of Equation (12) is that can be faster to evaluate for some embodiments as compared with the left-hand side. As an example, applying the equivalence of Equation (12) for the KL divergence of Equation (7) yields:





  
    
      
        
          
            ∑
            
              i
              =
              1
            
            D
          
          ⁢
          
            
              q
              i
            
            ⁢
            
              
                
                  p
                  i
                
                -
                
                  u
                  i
                
              
              
                
                  θ
                  ·
                  
                    p
                    i
                  
                
                +
                
                  
                    (
                    
                      1
                      -
                      θ
                    
                    )
                  
                  ⁢
                  
                    u
                    i
                  
                
              
            
          
        
        ≥
        0.
      
    
    
      
        (
        13
        )
      
    
  




The threshold θ is known. If the application is to compare numerous different first objects q 10 with a single reference second object p 12 in the context u 14, then the fraction terms of Equation (12) involving only p, u, and θ can be pre-computed and Equation (13) can be evaluated for each first object q 10 as a dot product.

The relationship set forth in Equation (12) can also be used to expedite computing similarity measures in other ways. For example in some applications it may be desired to determine the similarity value for all first objects whose similarity to a reference second object 12 in the context 14 exceeds the threshold θ. In these applications, a fast binary determination using the right-hand side of Equation (12) can be used to filter the first objects, and then Equation (1) can be used to determine the numerical similarity value for those first objects having similarities exceeding the threshold θ.
The context u 14 can be generated in various ways, depending upon the application and the available a priori knowledge. In some embodiments, the context u 14 represents a “typical” distribution of objects, and csƒ(q,p|u) then provides a quantitative assessment of how similar the first object q 10 is to the second object p 12 in the context u 14 of this “typical” distribution of objects. The context u 14 can, for example, be defined based on a set of N objects {o1, o2, . . . oN} that represent the context. One approach is:




  
    
      
        
          
            u
            f
          
          =
          
            arg
            ⁢
            
              
            
            ⁢
            
              
                max
                u
              
              ⁢
              
                {
                
                  
                    ∑
                    
                      k
                      =
                      1
                    
                    N
                  
                  ⁢
                  
                    f
                    ⁡
                    
                      (
                      
                        
                          o
                          k
                        
                        ,
                        u
                      
                      )
                    
                  
                
                }
              
            
          
        
        ,
      
    
    
      
        (
        14
        )
      
    
  




where ƒ is a non-contextual similarity measure. If a non-contextual difference or divergence measure is used in place of the similarity measure ƒ, then the arg maxu{ . . . } in Equation (14) is suitably replaced by arg minu{ . . . }. In some applications, it may be useful to generate contextual comparison measures at a number of different scales. One way to do this is to employ Equation (14) for different sub-sets of the N objects {o1, o2, . . . oN} selected based on a criterion such as closeness of the objects of the sub-set to a reference object, as measured (for example) by the non-contextual similarity measure ƒ. Equation (14) is merely an example of one way to define the context 14, and numerous other ways can also be used. In some embodiments, for example, the context 14 is suitably defined as a discrete or continuous probability distribution constructed based on a set of objects constructed based on other a priori information. For example, the context of “mammals and birds” can be defined as a set or range of characteristics such as: number of legs (two or four); number of wings (zero or two); and so forth, without reference to any particular mammal or bird.

The quantitative contextual comparison module 20 of FIG. 1, as well as retrieval systems, classification systems, clustering systems, or so forth that utilize the quantitative contextual comparison module 20, can be embodied in various ways. In the illustrated embodiments, a computer C includes a digital processor that is suitably programmed to perform the operations of the quantitative contextual comparison module 20 and of retrieval, classification, or clustering systems employing same. Other suitably programmed digital processors or controllers or devices including same can also be used, such as an Internet-based server system, or a personal data assistant (PDA), or an automated forms receiving system, or so forth. Additionally or alternatively, a storage medium suitably stores instructions executable by such a processor or controller to implement the quantitative contextual comparison module 20, and optionally to further implement a retrieval, classification, clustering, or other system using the quantitative contextual comparison module 20. The storage medium may, for example, comprise a hard disk or other magnetic storage medium that may be a standalone component or an integral part of a computer or other digital processing device, or an optical disk or other optical storage medium that may be a standalone component or an integral part of a computer or other digital processing device, or a FLASH memory or other electrostatic storage medium that may be a standalone component or an integral part of a computer or other digital processing device, or so forth.
With reference to FIG. 2, an illustrative image retrieval system is shown which is embodied by the computer C with suitable programming, and which employs the quantitative contextual comparison module 20 of FIG. 1. In this illustrative image retrieval application, a user employs a user interface 30 to identify an image of interest. For example, the image may be obtained from the Internet, or from a local area network, or may be generated by optically scanning a printed image, or so forth. The user interface 30 suitably incorporates the keyboard, mouse, or other user input devices of the computer C. The image is converted to a quantitative representation by a bag-of-visual-words representation extraction engine 327 and the resulting bag-of-visual-words representation of the user-selected image serves as the second object p 12. Quantitative bag-of-visual-words representations for images are known in the art, and are described (for example) in: Sivic et al., “Video google: A text retrieval approach to object matching in videos”, In IEEE ICCV (2003); Csurka et al., “Visual categorization with bags of keypoints”, in ECCV Workshop on Statistical Learning for Computer Vision (2004); both of which are incorporated herein by reference in their entireties.
The objective is to retrieve images from an archival images database 34 that are contextually similar to the image selected by the user. In the illustrated embodiment, the images of the images database 34 are stored together with corresponding bag-of-visual-words representations. Such an approach advantageously enables the stored images to be efficiently processed in quantitative fashion based on their bag-of-visual-words representations. Accordingly, an image selector 36 selects a first archived image from the archival images database 34 and the stored bag-of-visual-words representation of the selected archival image serves as the first object q 10. If the bag-of-visual-words representations are not stored in the archival images database 34, then the bag-of-visual-words representation extraction engine 32 can be invoked to create the bag-of-visual-words representation for the selected archival image.
The quantitative contextual comparison module 20 operates as described herein to output the quantitative comparison value 22. The context 14 is pre-defined in the embodiment illustrated in FIG. 2. For example, the context 14 may be a context typically employed by the user, such as a context of “animal images” if the user is an animal photographer. Alternatively, a plurality of selectable contexts can be stored in the images database 34 or elsewhere, and the user can select a desired appropriate context for the context 14 using the user interface 30 or another selection tool.
A retrieval coordinator 40 makes decisions regarding the image retrieval process. The coordination includes deciding whether or not to add the image selected by the selector 36 to a list of contextually similar images 42 based on whether the quantitative comparison value 22 satisfies a selection criterion (such as, for example, the threshold θ of previously described examples). The retrieval coordinator 40 also decides whether or not to continue to process more images based on criteria such as whether unprocessed archival images remain in the archival images database 34, whether the list of contextually similar images 42 has exceeded a maximum allowable value, or so forth. In this way, the image retrieval system cycles through the archival images in the database 34 to identify images that are contextually similar to the image selected by the user in view of the pre-selected context 14. After (and optionally during) the image retrieval process, the images contained in or identified by the list of contextually similar images 42 are suitably presented to the user via a display module 44, for example by being shown on a display of the computer C. The display module 44 optionally enables the user to perform operations on the listed images, such as removing images from the list based on the user's discretion, copying or transferring selected images from the list 42 to a desktop publishing application program (not shown) running concurrently on the computer C, or so forth.
The image retrieval application described with reference to FIG. 2 is an illustrative example. Other applications of the quantitative contextual comparison module 20 include, for example: classification, clustering, density estimation, and so forth. Indeed, the disclosed quantitative contextual comparison techniques are generally useful in any application that employs a similarity measure or a distance or divergence measure.
As another illustrative example, kernel classifiers typically score an object x respective to a set of training object examples {xi, i=1, . . . , N} having labels {yi, i=1, . . . , N} where yi=−1 indicates the corresponding training object xi does not belong to the class and yi=+1 indicates the corresponding training object xi does belong to the class. A typical kernel-based score takes the form




  
    s
    ⁡
    
      (
      x
      )
    
  
  =
  
    φ
    ⁡
    
      (
      
        
          
            ∑
            
              i
              =
              1
            
            N
          
          ⁢
          
            
              α
              i
            
            ⁢
            
              y
              i
            
            ⁢
            
              k
              ⁡
              
                (
                
                  x
                  ,
                  
                    x
                    i
                  
                
                )
              
            
          
        
        +
        b
      
      )
    
  




where φ is a non-decreasing function and {αi, i=1, . . . , N} and b are parameters to be estimated during training. In existing kernel classifiers the function k is typically a non-contextual similarity measure. By using a contextual similarity measure disclosed herein, with a suitable context, for the function k, the kernel classifier accuracy can be improved. The context can be generated, for example, from the training set using the approach of Equation (14) or using another approach.

The disclosed contextual similarity measures can also be used for clustering applications. For example, one illustrative hierarchical contextual clustering (HCC) procedure is as follows. The procedure clusters a set L of distributions. First, the context u is estimated from the set of distributions L, using the approach of Equation (14) or using another approach. Second, the contextual similarity between all pairs of distributions in L in the context u is computed using Equation (1) to form a contextual similarity matrix. Clustering is then performed using substantially any kernel clustering method operating on the contextual similarity matrix to obtain K clusters. Finally, assigning L1, L2, . . . , LK as the lists of distributions corresponding to the K clusters, the hierarchical contextual clusters are defined as HCC(L1), HCC(L2), . . . , HCC(LK).
It will be appreciated that various of the above-disclosed and other features and functions, or alternatives thereof, may be desirably combined into many other different systems or applications. Also that various presently unforeseen or unanticipated alternatives, modifications, variations or improvements therein may be subsequently made by those skilled in the art which are also intended to be encompassed by the following claims.

## Claims

1. A storage medium storing instructions executable to compare first and second objects in a context by:
maximizing or minimizing a comparison function including at least one of ƒ(q,ω·p+(1−ω)·u) and ƒ(q,(1−ω)·p+ω·u) respective to a weighting parameter ω where the first object is represented as q, the second object is represented as p, the context is represented as u, and function ƒ is a similarity, difference, or divergence measure, and
outputting a comparison value that is equal to or determined based on a value of the weighting parameter ω obtained by the maximizing or minimizing.

2. The storage medium as set forth in claim 1, wherein the comparison function is a similarity measure, and the instructions are executable to compare the first and second objects in the context by maximizing the similarity measure respective to the weighting parameter.

3. The storage medium as set forth in claim 2, wherein the outputting comprises outputting a contextual similarity measure equal to the value of the weighting parameter that maximizes the similarity measure.

4. The storage medium as set forth in claim 1, wherein the comparison function is a difference or divergence measure.

5. The storage medium as set forth in claim 1, wherein the comparison function is selected from the class of Bregman divergences.

6. The storage medium as set forth in claim 1, wherein the comparison function is selected from the class of Csizár divergences.

7. The storage medium as set forth in claim 1, wherein the maximizing or minimizing of the comparison function respective to a weighting parameter ω is performed under the constraint that the weighting ω lies in an interval [0,1].

8. The storage medium as set forth in claim 1, wherein the maximizing or minimizing of the comparison function respective to a weighting parameter is terminated responsive to the weighting parameter satisfying a termination criterion.

9. The storage medium as set forth in claim 1, further storing instructions executable to perform a retrieval method including retrieving the first object conditional upon the outputted comparison value.

10. The storage medium as set forth in claim 1, further storing instructions executable to perform a clustering method including grouping together first and second objects based at least in part on the outputted comparison value.

11. The storage medium as set forth in claim 1, wherein the comparison function is symmetrized by further including a quantitative comparison of the second object p and a mixture of the first object q and the context u wherein the quantitative comparison of the second object p and the mixture of the first object q and the context u is also controlled by the weighting parameter ω.

12. The storage medium as set forth in claim 1, wherein the comparison function comprises a symmetrized similarity measure scsƒ(q,p)=arg maxω{ƒ(q,ω·p+(1−ω)·u)+ƒ(p,ω·q+(1−ω)·u)} where 0≦ω≦1.

13. A storage medium storing instructions executable to compare first and second objects in a context by:
maximizing or minimizing a comparison function respective to a weighting parameter, the comparison function including a quantitative comparison of the first object and a mixture of the second object and the context wherein the mixture is controlled by the weighting parameter, wherein the maximizing or minimizing comprises maximizing or minimizing ƒ(q,ω·p+(1−ω)·u) or ƒ(q,(1−ω)·p+ω·u) respective to the weighting parameter represented as ω, where the first object is represented as q, the second object is represented as p, the context is represented as u, and ƒ is a similarity, difference, or divergence measure; and
outputting a comparison value that is equal to or determined based on a value of the weighting parameter obtained by the maximizing or minimizing.

14. The storage medium as set forth in claim 13, wherein the maximizing or minimizing is performed under the constraint 0≦ω≦1.

15. A method comprising:
comparing first and second objects in a context by maximizing or minimizing a comparison function including at least one of ƒ(q,ω·p+(1−ω)·u) and ƒ(q,(1−ω)·p+ω·u) respective to a weighting parameter ω where the first object is represented as q, the second object is represented as p, the context is represented as u, and function ƒ is a similarity, difference, or divergence measure; and
outputting a comparison value that is equal to or determined based on a value of the weighting parameter ω obtained by the maximizing or minimizing;
wherein the comparing and outputting operations are performed by a digital processor.

16. The method as set forth in claim 15, further comprising:
retrieving the first object q conditional upon the outputted comparison value satisfying a threshold.

17. The method as set forth in claim 15, wherein the outputting comprises:
outputting a binary decision value indicative of whether the value of the weighting parameter ω determined by the maximizing or minimizing satisfies a threshold.

18. A digital processor configured to perform the method of claim 15.