-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
60 lines (43 loc) · 1.65 KB
/
Copy pathmain.py
File metadata and controls
60 lines (43 loc) · 1.65 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
Entry point — runs both RL pipelines on bank-full.csv.
Usage:
python main.py
"""
import sys
from pathlib import Path
# Make project root importable regardless of working directory
sys.path.insert(0, str(Path(__file__).parent))
from data.loader import load_and_preprocess, check_edge_cases
from ground_truth.generator import generate_ground_truth
from pipeline1.pipeline import run_pipeline1
from pipeline2.pipeline import run_pipeline2
from config import OUTPUT_DIR
def _print_final_summary(p1: dict, p2: list[dict]) -> None:
print("\n" + "=" * 60)
print("FINAL SUMMARY")
print("=" * 60)
print("\n[Pipeline 1 — Imputation] Best method per scenario (by MAE):")
for scenario, metrics in p1.items():
best = min(metrics, key=lambda k: metrics[k]["NRMSE"])
m = metrics[best]
print(f" {scenario:<22} -> {best:<8} MAE={m['MAE']:.4f} RMSE={m['RMSE']:.4f}")
print("\n[Pipeline 2 — Classification] Ranked by F1:")
for m in sorted(p2, key=lambda x: x["F1"], reverse=True):
print(f" {m['name']:<35} F1={m['F1']:.4f} "
f"MCC={m['MCC']:.4f} G-Mean={m['G-Mean']:.4f}")
print(f"\nAll outputs -> {OUTPUT_DIR.resolve()}")
print("Files:")
for f in sorted(OUTPUT_DIR.iterdir()):
print(f" {f.name}")
def main() -> None:
print("\n" + "#" * 60)
print(" RL PIPELINES -- BANK MARKETING DATASET")
print("#" * 60)
df, _encoders = load_and_preprocess()
check_edge_cases(df)
generate_ground_truth(df)
p1_metrics = run_pipeline1(df)
p2_metrics = run_pipeline2(df)
_print_final_summary(p1_metrics, p2_metrics)
if __name__ == "__main__":
main()