TSVM

class s3l.classification.TSVM.TSVM(kernel='RBF', C1=100, C2=0.1, alpha=0.1, beta=-1, gamma=0)[source]

Bases: s3l.base.InductiveEstimatorWOGraph

TSVM classifier

Parameters:
  • kernel ({'Linear', 'RBF'} (default='RBF')) – String identifier for kernel function to use or the kernel function itself. Only ‘Linear’ and ‘RBF’ strings are valid inputs.
  • C1 (float (default=100)) – Initial weight for labeled instances.
  • C2 (float (default=0.1)) – Initial weight for unlabeled instances.
  • alpha (float (default=0.1)) – Balance parameter
  • beta (float (default=-1)) – Balance parameter
  • gamma (float (default=0)) – Parameter for RBF kernel
Other Parameters:
 

model (object) – Best model.

fit(X, y, labeled_idx)[source]

Fit a semi-supervised SVM model

All the input data is provided matrix X (labeled and unlabeled) and corresponding label matrix y with a dedicated marker value for unlabeled samples.

Parameters:
  • X (array-like, shape = [n_samples, n_features]) – A {n_samples by n_samples} size matrix will be created from this
  • y (array_like, shape = [n_samples]) – n_labeled_samples (unlabeled points are marked as 0)
  • labeled_idx (array_like, shape = [n_samples]) – index of n_labeled_samples in X.
Returns:

self

Return type:

returns an instance of self.

predict(X)[source]

Performs inductive inference across the model.

Parameters:X (array_like, shape = [n_samples, n_features]) –
Returns:y – Predictions for input data
Return type:array_like, shape = [n_samples]
set_params(param)[source]

Parameter setting function.

Parameters:param:dict – Store parameter names and corresponding values {‘name’: value}.