TrainParticleClassifier¶
-
class
ctapipe.tools.train_particle_classifier.
TrainParticleClassifier
(**kwargs: Any)[source]¶ Bases:
ctapipe.core.tool.Tool
Tool to train a
ParticleClassifier
on dl1b/dl2 data.The tool first performs a cross validation to give an initial estimate on the quality of the estimation and then finally trains one model per telescope type on the full dataset.
Attributes Summary
Input dl1b/dl2 file for the background class.
Input dl1b/dl2 file for the signal class.
Number of background events to be used for training.
Number of signal events to be used for training.
Output file for the trained reconstructor.
Random number seed for sampling and the cross validation splitting
Methods Summary
finish
()Write-out trained models and cross-validation results.
setup
()Initialize components from config
start
()Train models per telescope type.
Attributes Documentation
-
aliases
: Dict[Union[str, Tuple[str, …]], Union[str, Tuple[str, str]]] = {'signal': 'TrainParticleClassifier.input_url_signal', 'background': 'TrainParticleClassifier.input_url_background', 'n-signal': 'TrainParticleClassifier.n_signal', 'n-background': 'TrainParticleClassifier.n_background', ('o', 'output'): 'TrainParticleClassifier.output_path', 'cv-output': 'CrossValidator.output_path'}¶
-
classes
: List[Type[Any]] = [<class 'ctapipe.io.tableloader.TableLoader'>, <class 'ctapipe.reco.sklearn.ParticleClassifier'>, <class 'ctapipe.reco.sklearn.CrossValidator'>]¶
-
description
: Union[str, ctapipe.core.traits.Unicode] = '\n Tool to train a `~ctapipe.reco.ParticleClassifier` on dl1b/dl2 data.\n\n The tool first performs a cross validation to give an initial estimate\n on the quality of the estimation and then finally trains one model\n per telescope type on the full dataset.\n '¶
-
examples
: Union[str, ctapipe.core.traits.Unicode] = '\n ctapipe-train-particle-classifier \\\n -c train_particle_classifier.yaml \\\n --signal gamma.dl2.h5 \\\n --background proton.dl2.h5 \\\n -o particle_classifier.pkl\n '¶
-
input_url_background
¶ Input dl1b/dl2 file for the background class.
-
input_url_signal
¶ Input dl1b/dl2 file for the signal class.
-
n_background
¶ Number of background events to be used for training. If not given, all available events will be used.
-
n_signal
¶ Number of signal events to be used for training. If not given, all available events will be used.
-
name
: Union[str, ctapipe.core.traits.Unicode] = 'ctapipe-train-particle-classifier'¶
-
output_path
¶ Output file for the trained reconstructor. At the moment, pickle is the only supported format.
-
random_seed
¶ Random number seed for sampling and the cross validation splitting
Methods Documentation
-