-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain_xgb_classify.py
More file actions
42 lines (28 loc) · 1.08 KB
/
train_xgb_classify.py
File metadata and controls
42 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Train XGBoost BDTs for gamma/hadron classification.
Uses image and stereo parameters to train classification BDTs to separate
gamma-ray events from hadronic background events.
Trains a single BDT on all telescope multiplicity events.
"""
import logging
from eventdisplay_ml.config import configure_training
from eventdisplay_ml.data_processing import load_training_data
from eventdisplay_ml.models import save_models, train_classification
logging.basicConfig(level=logging.INFO)
_logger = logging.getLogger(__name__)
def main():
"""Run the training pipeline."""
analysis_type = "classification"
model_configs = configure_training(analysis_type)
df = [
load_training_data(model_configs, file_list, analysis_type)
for file_list in (
model_configs["input_signal_file_list"],
model_configs["input_background_file_list"],
)
]
model_configs = train_classification(df, model_configs)
save_models(model_configs)
_logger.info(f"XGBoost {analysis_type} model trained successfully.")
if __name__ == "__main__":
main()