File size: 999 Bytes
e4b1ed6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Generate calibrated and governance post-processed predictions."""

from __future__ import annotations

import argparse
from pathlib import Path

try:
    from .evaluate_model import predict_for_model_run
except ImportError:  # pragma: no cover - direct script execution
    from evaluate_model import predict_for_model_run


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--model-run", type=Path, required=True)
    parser.add_argument("--features", type=Path, required=True)
    parser.add_argument("--output", type=Path, required=True)
    args = parser.parse_args(argv)
    _, predictions = predict_for_model_run(args.model_run, args.features)
    args.output.parent.mkdir(parents=True, exist_ok=True)
    predictions.to_csv(args.output, index=False)
    print(f"wrote_predictions: {args.output}")
    print(f"rows: {len(predictions)}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())