File size: 1,920 Bytes
7fcaffe
9678fdb
 
2aed0aa
 
 
 
 
 
 
 
e012a04
7fcaffe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3994c21
e012a04
 
bf7e729
 
e012a04
7fcaffe
e012a04
5271c2e
 
 
 
7fcaffe
5271c2e
 
 
 
 
 
 
7fcaffe
5271c2e
7fcaffe
5271c2e
 
 
e012a04
bf7e729
 
 
 
 
7fcaffe
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from ..args import get_prediction_args
from .pipeline import PredictionPipeline
from .models import (
    EloBaselineModel, 
    LogisticRegressionModel, 
    XGBoostModel,
    SVCModel,
    RandomForestModel,
    BernoulliNBModel,
    LGBMModel
)

def get_available_models():
    """Get a list of all available prediction models.
    
    Returns:
        list: List of instantiated model objects
    """
    return [
        EloBaselineModel(),
        LogisticRegressionModel(),
        # XGBoostModel(),
        # SVCModel(),
        # RandomForestModel(),
        # BernoulliNBModel(),
        LGBMModel(),
    ]

def main():
    """
    Main entry point to run the prediction pipeline.
    You can specify which models to run and the reporting format.
    """
    args = get_prediction_args()

    # Handle conflicting arguments
    use_existing_models = not args.no_use_existing_models and args.use_existing_models
    force_retrain = args.force_retrain

    # Log model management settings
    if args.no_use_existing_models:
        print("No-use-existing-models flag set: All models will be retrained from scratch.")
    elif force_retrain:
        print("Force-retrain flag set: All models will be retrained regardless of new data.")
    elif use_existing_models:
        print("Using existing models if available and no new data detected.")

    # Initialize and run prediction pipeline
    pipeline = PredictionPipeline(
        models=get_available_models(),
        use_existing_models=use_existing_models,
        force_retrain=force_retrain
    )
    
    try:
        pipeline.run(detailed_report=(args.report == 'detailed'))
    except FileNotFoundError as e:
        print(f"Error: {e}")
        print("Please ensure the required data files exist. You may need to run the scraping and ELO analysis first.")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")
        raise