Transfer Component Classifier

class libtlda.tca.TransferComponentClassifier(loss_function='logistic', l2_regularization=1.0, mu=1.0, num_components=1, kernel_type='rbf', bandwidth=1.0, order=2.0)

Class of classifiers based on Transfer Component Analysis.

Methods contain component analysis and general utilities.

Methods

fit(X, y, Z) Fit/train a classifier on data mapped onto transfer components.
get_params() Get classifier parameters.
is_trained() Check whether classifier is trained.
kernel(X, Z[, type, order, bandwidth]) Compute kernel for given data set.
predict(Z) Make predictions on new dataset.
transfer_component_analysis(X, Z) Transfer Component Analysis.
fit(X, y, Z)

Fit/train a classifier on data mapped onto transfer components.

Parameters:
X : array

source data (N samples by D features)

y : array

source labels (N samples by 1)

Z : array

target data (M samples by D features)

Returns:
None
get_params()

Get classifier parameters.

is_trained()

Check whether classifier is trained.

kernel(X, Z, type='rbf', order=2, bandwidth=1.0)

Compute kernel for given data set.

Parameters:
X : array

data set (N samples by D features)

Z : array

data set (M samples by D features)

type : str

type of kernel, options: ‘linear’, ‘polynomial’, ‘rbf’, ‘sigmoid’ (def: ‘linear’)

order : float

degree for the polynomial kernel (def: 2.0)

bandwidth : float

kernel bandwidth (def: 1.0)

Returns:
array

kernel matrix (N+M by N+M)

predict(Z)

Make predictions on new dataset.

Parameters:
Z : array

new data set (M samples by D features)

Returns:
preds : array

label predictions (M samples by 1)

transfer_component_analysis(X, Z)

Transfer Component Analysis.

Parameters:
X : array

source data set (N samples by D features)

Z : array

target data set (M samples by D features)

Returns:
C : array

transfer components (D features by num_components)

K : array

source and target data kernel distances