actsnclass.learn_loop

actsnclass.learn_loop(nloops: int, strategy: str, path_to_features: str, output_metrics_file: str, output_queried_file: str, features_method='Bazin', classifier='RandomForest', training='original', batch=1, screen=True, survey='DES', nclass=2, photo_class_thr=0.5, photo_ids=False, photo_ids_tofile=False, photo_ids_froot=' ', classifier_bootstrap=False, **kwargs)

Perform the active learning loop. All results are saved to file.

Parameters:
  • nloops (int) – Number of active learning loops to run.
  • strategy (str) – Query strategy. Options are ‘UncSampling’ and ‘RandomSampling’.
  • path_to_features (str or dict) – Complete path to input features file. if dict, keywords should be ‘train’ and ‘test’, and values must contain the path for separate train and test sample files.
  • output_metrics_file (str) – Full path to output file to store metric values of each loop.
  • output_queried_file (str) – Full path to output file to store the queried sample.
  • features_method (str (optional)) – Feature extraction method. Currently only ‘Bazin’ is implemented.
  • classifier (str) – Machine Learning algorithm. Currently implemented options are ‘RandomForest’, ‘GradientBoostedTrees’, ‘K-NNclassifier’,’MLPclassifier’,’SVMclassifier’ and ‘NBclassifier’.
  • training (str or int (optional)) – Choice of initial training sample. If ‘original’: begin from the train sample flagged in the file If int: choose the required number of samples at random, ensuring that at least half are SN Ia Default is ‘original’.
  • batch (int (optional)) – Size of batch to be queried in each loop. Default is 1.
  • photo_class_thr (float (optional)) – Threshold for photometric classification. Default is 0.5. Only used if photo_ids is True.
  • photo_ids (bool (optional)) – Get photometrically classified ids. Default is False.
  • photo_ids_to_file (bool (optional)) – If True, save photometric ids to file. Default is False.
  • photo_ids_froot (str (optional)) – Output root of file name to store photo ids. Only used if photo_ids is True.
  • screen (bool (optional)) – If True, print on screen number of light curves processed.
  • survey (str (optional)) – ‘DES’ or ‘LSST’. Default is ‘DES’. Name of the survey which characterizes filter set.
  • nclass (int (optional)) – Number of classes to consider in the classification Currently only nclass == 2 is implemented.
  • bootstrap (bool (optional)) – Flag for bootstrapping on the classifier Must be true if using disagreement based strategy
  • kwargs (extra parameters) – All keywords required by the classifier function.