Experiments

Class to implement the process of semi-supervised learning experiments.

class s3l.Experiments.SslExperimentsWithoutGraph(transductive=True, n_jobs=1, metri_param={}, all_class=True)[source]

Bases: s3l.base.BaseExperiments

Semi-supervised learning experiments without graph.

This class implements a common process of SSL experiments in both transductive and inductive settings. It optimize the hyper-parameters using grid-search policy which is paralleled using multi-processing.

Parameters:
  • transductive (boolean, optional (default=True)) – The experiment is transductive if True else inductive.
  • n_jobs (int, optional (default=1)) – The nunmber of jobs to run the experiemnt.
  • all_class (boolean, optional (default=True)) – Whether all split should have all classes.
performance_metric_name

The name of the metric.

Type:string, optional (default=’accuracy_score’)
metri_param

A dict store the

Type:dict, optional (default={})
datasets

A list of tuple which store the information of datasets to run.

Type:list
configs

A list of tuple which store the information of algorithms to evaluate.

Type:list
performance_metric

A callable object which is the evaluating method.

Type:callable
metri_param

A dict which store the parameters for self.performance_metric.

Type:dict

Notes

  1. Multi-processing requests the estimator to be picklable. You may refer to __getstate__ and __setstate__ methods when your self-defined estimator has some problems with serialization.
experiments_on_datasets(unlabel_ratio=0.8, test_ratio=0.3, number_init=5)[source]

The datasets are splits randomly or based on given splits. Get Label/Unlabel splits for each dataset in this funciton and conduct experiments on them. Results are stored for each dataset.

Parameters:
  • unlabel_ratio (float) – The ratio of test data for each dataset.
  • number_init (int) – Different label initializations for each dataset.
Returns:

results – {dataset_name: {config_name:[scores]} }

Return type:

dict

class s3l.Experiments.SslExperimentsWithGraph(n_jobs=1)[source]

Bases: s3l.base.BaseExperiments

Semi-supervised learning experiments with graph.

This class implements a common process of SSL experiments in both transductive and inductive settings for graph-based methods. It optimize the hyper-parameters using grid-search policy which is paralleled using multi-processing.

Parameters:
  • transductive (boolean, optional (default=True)) – The experiment is transductive if True else inductive.
  • n_jobs (int, optional (default=1)) – The nunmber of jobs to run the experiemnt.
  • all_class (boolean, optional (default=True)) – Whether all split should have all classes.
performance_metric_name

The name of the metric.

Type:string, optional (default=’accuracy_score’)
metri_param

A dict store the

Type:dict, optional (default={})
datasets

A list of tuple which store the information of datasets to run.

Type:list
configs

A list of tuple which store the information of algorithms to evaluate.

Type:list
performance_metric

A callable object which is the evaluating method.

Type:callable
metri_param

A dict which store the parameters for self.performance_metric.

Type:dict

Notes

  1. Multi-processing requests the estimator to be picklable. You may refer to __getstate__ and __setstate__ methods when your self-defined estimator has some problems with serialization.
experiments_on_datasets(unlabel_ratio=0.8, test_ratio=0.3, number_init=5)[source]

The datasets are splits randomly or based on given splits. Get Label/Unlabel splits for each dataset in this funciton and conduct experiments on them. Results are stored for each dataset.

Parameters:
  • unlabel_ratio (float) – The ratio of unlabeled data for each dataset.
  • test_ratio (float) – The ratio of test data for each dataset. Is invalid when `transductive`=True.
  • number_init (int) – Different label initializations for each dataset.
Returns:

results – {dataset_name: {config_name:[scores]} }

Return type:

dict