TrainCTLearnKerasModel#
- class ctlearn.tools.keras.train_model.TrainCTLearnKerasModel(*args: t.Any, **kwargs: t.Any)[source]#
Bases:
TrainCTLearnModelTool to train a
~ctlearn.core.model.CTLearnModelKeras-based model on R1/DL1a data.The tool trains a CTLearn Keras-based model on the input data (R1 calibrated waveforms or DL1a images) and saves the trained model in the output directory. The input data is loaded from the input directories for signal and background events using the
~dl1_data_handler.reader.DLDataReaderand~dl1_data_handler.loader.DLDataLoader. The tool supports the following reconstruction tasks: - Classification of the primary particle type (gamma/proton) - Regression of the primary particle energy - Regression of the primary particle arrival direction based on the offsets in camera coordinates - Regression of the primary particle arrival direction based on the offsets in sky coordinatesAttributes Summary
Methods Summary
Initialize the backend-specific parameters (e.g., PyTorch or Keras devices and distributed strategies).
start()Execute the core logic of the tool.
Attributes Documentation
- description = '\n Tool to train a ``~ctlearn.core.model.CTLearnModel`` Keras-based model on R1/DL1a data.\n\n The tool trains a CTLearn Keras-based model on the input data (R1 calibrated waveforms or DL1a images) and\n saves the trained model in the output directory. The input data is loaded from the input directories\n for signal and background events using the ``~dl1_data_handler.reader.DLDataReader`` and\n ``~dl1_data_handler.loader.DLDataLoader``. The tool supports the following reconstruction tasks:\n - Classification of the primary particle type (gamma/proton)\n - Regression of the primary particle energy\n - Regression of the primary particle arrival direction based on the offsets in camera coordinates\n - Regression of the primary particle arrival direction based on the offsets in sky coordinates\n '#
- examples = '\n To train a Keras-based CTLearn model for the classification of the primary particle type:\n > ctlearn-train-keras-model --signal /path/to/your/gammas_dl1_dir/ --pattern-signal "gamma_*_run1.dl1.h5" --pattern-signal "gamma_*_run10.dl1.h5" --background /path/to/your/protons_dl1_dir/ --pattern-background "proton_*_run1.dl1.h5" --pattern-background "proton_*_run10.dl1.h5" --output /path/to/your/type/ --reco type \n To train a Keras-based CTLearn model for the regression of the primary particle energy:\n > ctlearn-train-keras-model --signal /path/to/your/gammas_dl1_dir/ --pattern-signal "gamma_*_run1.dl1.h5" --pattern-signal "gamma_*_run10.dl1.h5" --output /path/to/your/energy/ --reco energy \n To train a Keras-based CTLearn model for the regression of the primary particle\n arrival direction based on the offsets in camera coordinates:\n > ctlearn-train-keras-model --signal /path/to/your/gammas_dl1_dir/ --pattern-signal "gamma_*_run1.dl1.h5" --pattern-signal "gamma_*_run10.dl1.h5" --output /path/to/your/direction/ --reco cameradirection \n To train a Keras-based CTLearn model for the regression of the primary particle\n arrival direction based on the offsets in sky coordinates:\n > ctlearn-train-keras-model --signal /path/to/your/gammas_dl1_dir/ --pattern-signal "gamma_*_run1.dl1.h5" --pattern-signal "gamma_*_run10.dl1.h5" --output /path/to/your/direction/ --reco skydirection '#
- name = 'ctlearn-train-keras-model'#
Methods Documentation