# -*- coding: utf-8 -*-
from pathlib import Path

import pandas as pd


ROOT = Path(__file__).resolve().parents[2]
OUT = ROOT / "検証" / "results" / "downstream_model_comparison"


def main():
    features = pd.read_csv(OUT / "features.csv")
    comparison = pd.read_csv(OUT / "model_comparison.csv")
    print("target describe")
    print(features[["human_soup_score", "human_total_score"]].describe().to_string())
    print("total > 100")
    high = features[features["human_total_score"] > 100]
    if high.empty:
        print("none")
    else:
        print(high[["row_id", "sample_id", "human_soup_score", "human_total_score", "video_path"]].to_string(index=False))
    print("total < 0")
    low = features[features["human_total_score"] < 0]
    print("none" if low.empty else low[["row_id", "sample_id", "human_total_score"]].to_string(index=False))
    print("best rows")
    print(comparison.sort_values(["target", "test_mae"]).groupby("target").head(10).to_string(index=False))
    print("fixed score rows")
    fixed = comparison[comparison["model"] == "固定配点"]
    print(fixed[["target", "feature_set", "model", "test_rho", "test_mae", "test_rmse", "test_grade_match"]].to_string(index=False))


if __name__ == "__main__":
    main()
