public class PairwiseSumKernel extends KernelOnPairs
baseKernel
Constructor and Description |
---|
PairwiseSumKernel() |
PairwiseSumKernel(Kernel baseKernel,
boolean intraPairSimProduct)
Defines a Kernel operating on pairs that applies the following formula:
\(K( < x_1, x_2 >, < y_1,y_2 > ) = BK(x_1, y_1) + BK(x_2, y_2) + BK(x_1, y_2) + BK(x_2, y_1)\) |
Modifier and Type | Method and Description |
---|---|
boolean |
getIntraPairSimProduct() |
float |
kernelComputationOverPairs(Example exA1,
Example exA2,
Example exB1,
Example exB2)
Returns the kernel computation
|
void |
setIntraPairSimProduct(boolean intraPairSimProduct)
Sets whether adding or not to the kernel combination an extra term equivalent to the
multiplication of the intra-pair similarities, i.e.:
\(BK(x_1,x_2) \cdot BK(y_1,y_2)\)
|
kernelComputation
getBaseKernel, setBaseKernel
disableCache, getKernelCache, getKernelComputations, getNumberOfHits, getNumberOfMisses, getSquaredNormCache, innerProduct, load, reset, save, setKernelCache, setSquaredNormCache, squaredNorm, squaredNormOfTheDifference
public PairwiseSumKernel(Kernel baseKernel, boolean intraPairSimProduct)
baseKernel
- the base kernel BKintraPairSimProduct
- whether adding or not the following term to K: \(BK(x_1,x_2) \cdot BK(y_1,y_2)\)
NOTE: the additional intra-pair similarity term corresponds to adding a feature \(BK(x_1,x_2)\) to the example \(< x_1, x_2 >\). Instead of enabling this additional term, it would be more efficient to explicitly adding a new vector representation to example that includes that feature. This can be easily done using the manipulate method of PairSimilarityExtractor (it is included in vector-representation)
public PairwiseSumKernel()
public boolean getIntraPairSimProduct()
public void setIntraPairSimProduct(boolean intraPairSimProduct)
NOTE: the additional intra-pair similarity term corresponds to adding a feature \(BK(x_1,x_2)\) to the example \(< x_1, x_2 >\). Instead of enabling this additional term, it would be more efficient to explicitly adding a new vector representation to example that includes that feature. This can be easily done using the manipulate method of PairSimilarityExtractor (it is included in vector-representation)
intraPairSimProduct
- whether adding or not the
multiplication of the intra-pair similaritiespublic float kernelComputationOverPairs(Example exA1, Example exA2, Example exB1, Example exB2)
KernelOnPairs
kernelComputationOverPairs
in class KernelOnPairs
exA1
- the first element of the first pairexA2
- the second element of the first pairexB1
- the first element of the second pairexB2
- the second element of the second pairCopyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.