twodlearn.kernels module

class twodlearn.kernels.ConcatOnes(**kargs)[source]

Bases: twodlearn.core.common.TdlModel

Concat ones at the right of input matrix

Tdl autoinitialization with arguments:

Attributes:

class ConcatOnesBasis(**kargs)[source]

Bases: twodlearn.core.common.OutputModel

evaluate(w)[source]

evaluate the product with vector w

linop[source]
evaluate(*args, **kargs)[source]
class twodlearn.kernels.GaussianKernel(l_scale=None, f_scale=None, y_scale=None, feature_ndims=1, **kargs)[source]

Bases: twodlearn.core.common.TdlModel

gaussian kernel calculation between matrices X1 and X2

X1 is a matrix, whose rows represent samples. X2 is a matrix, whose rows represent samples.

\[K(i,j) = (f_{scale}^2) \exp(-0.5 (x_1(i)-x_2(j))^T (l^{-2}) I (x_1(i)-x_2(j)) ) + y_{scale}^2 I\]

Tdl autoinitialization with arguments:

input_shape[source]

(InputArgument)

f_scale[source]

(SimpleParameter)

feature_ndims[source]

(InputArgument)

y_scale[source]

(SimpleParameter)

l_scale[source]

(SimpleParameter)

batch_eval(*args, **kargs)[source]
evaluate(*args, **kargs)[source]
f_scale[source]
feature_ndims[source]
input_shape[source]
l_scale[source]
y_scale[source]
class twodlearn.kernels.PairwiseL2(x1, x2, name='PairwiseL2')[source]

Bases: twodlearn.core.common.TdlOp

Tdl autoinitialization with arguments:

Attributes:

property value[source]
property x1[source]

\(x_1\) input for the PairwiseL2 operation \((||x_1 - x_2||^2)\)

property x2[source]

\(x_2\) input for the PairwiseL2 operation \((||x_1 - x_2||^2)\)

class twodlearn.kernels.QuadraticFeatures(include_inputs=False, name=None, **kargs)[source]

Bases: twodlearn.core.common.TdlModel

Concat ones at the right of input matrix

Tdl autoinitialization with arguments:

include_inputs[source]

(InputArgument)

evaluate(*args, **kargs)[source]
include_inputs[source]
twodlearn.kernels.polynomial_kernel()[source]