public class UncrossedPairwiseProductKernel extends KernelOnPairs
baseKernel
Constructor and Description |
---|
UncrossedPairwiseProductKernel() |
UncrossedPairwiseProductKernel(Kernel baseKernel,
boolean intraPairSimProduct)
Defines a Kernel operating on pairs that applies the following formula:
K(<x1,x2>,<y1,y2>)=BK(x1,y1)⋅BK(x2,y2) |
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(x1,x2)⋅BK(y1,y2)
|
kernelComputation
getBaseKernel, setBaseKernel
disableCache, getKernelCache, getKernelComputations, getNumberOfHits, getNumberOfMisses, getSquaredNormCache, innerProduct, load, reset, save, setKernelCache, setSquaredNormCache, squaredNorm, squaredNormOfTheDifference
public UncrossedPairwiseProductKernel(Kernel baseKernel, boolean intraPairSimProduct)
baseKernel
- the base kernel BKintraPairSimProduct
- whether adding or not the following term to K: BK(x1,x2)⋅BK(y1,y2)
NOTE: the additional intra-pair similarity term corresponds to adding a feature BK(x1,x2) to the example <x1,x2>. 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 UncrossedPairwiseProductKernel()
public boolean getIntraPairSimProduct()
public void setIntraPairSimProduct(boolean intraPairSimProduct)
NOTE: the additional intra-pair similarity term corresponds to adding a feature BK(x1,x2) to the example <x1,x2>. 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.