Usage Examples¶
Baseball Players (Flat Data)¶
Case 1: Players Table only¶
import pandas as pd
import webbrowser
from mostlyai.qa import report
repo = "https://github.com/mostly-ai/mostlyai-qa"
path = "/raw/refs/heads/main/examples/baseball-players"
report_path, metrics = report(
syn_tgt_data=pd.read_parquet(f"{repo}/{path}/synthetic-target.pqt"),
trn_tgt_data=pd.read_parquet(f"{repo}/{path}/training-target.pqt"),
hol_tgt_data=pd.read_parquet(f"{repo}/{path}/holdout-target.pqt"),
report_subtitle=" for Baseball Players",
report_path="baseball-players.html",
)
print(metrics.model_dump_json(indent=4))
webbrowser.open(f"file://{report_path.absolute()}")
👉 HTML Report
Case 2: Players Table with Context¶
import pandas as pd
import webbrowser
from mostlyai.qa import report
repo = "https://github.com/mostly-ai/mostlyai-qa"
path = "/raw/refs/heads/main/examples/baseball-players"
report_path, metrics = report(
syn_tgt_data=pd.read_parquet(f"{repo}/{path}/synthetic-target.pqt"),
syn_ctx_data=pd.read_parquet(f"{repo}/{path}/synthetic-context.pqt"),
trn_tgt_data=pd.read_parquet(f"{repo}/{path}/training-target.pqt"),
trn_ctx_data=pd.read_parquet(f"{repo}/{path}/training-context.pqt"),
hol_tgt_data=pd.read_parquet(f"{repo}/{path}/holdout-target.pqt"),
hol_ctx_data=pd.read_parquet(f"{repo}/{path}/holdout-context.pqt"),
tgt_context_key="id",
ctx_primary_key="id",
report_subtitle=" for Baseball Players",
report_path="baseball-players-with-context.html",
)
print(metrics.model_dump_json(indent=4))
webbrowser.open(f"file://{report_path.absolute()}")
Baseball Seasons (Sequential Data)¶
Case 1: Seasons Table only¶
import pandas as pd
import webbrowser
from mostlyai.qa import report
repo = "https://github.com/mostly-ai/mostlyai-qa"
path = "/raw/refs/heads/main/examples/baseball-seasons"
report_path, metrics = report(
syn_tgt_data=pd.read_parquet(f"{repo}/{path}/synthetic-target.pqt"),
trn_tgt_data=pd.read_parquet(f"{repo}/{path}/training-target.pqt"),
hol_tgt_data=pd.read_parquet(f"{repo}/{path}/holdout-target.pqt"),
tgt_context_key="players_id",
report_subtitle=" for Baseball Seasons",
report_path="baseball-seasons.html",
)
print(metrics.model_dump_json(indent=4))
webbrowser.open(f"file://{report_path.absolute()}")
👉 HTML Report
Case 2: Seasons Table with Context¶
import pandas as pd
import webbrowser
from mostlyai.qa import report
repo = "https://github.com/mostly-ai/mostlyai-qa"
path = "/raw/refs/heads/main/examples/baseball-seasons"
report_path, metrics = report(
syn_tgt_data=pd.read_parquet(f"{repo}/{path}/synthetic-target.pqt"),
syn_ctx_data=pd.read_parquet(f"{repo}/{path}/synthetic-context.pqt"),
trn_tgt_data=pd.read_parquet(f"{repo}/{path}/training-target.pqt"),
trn_ctx_data=pd.read_parquet(f"{repo}/{path}/training-context.pqt"),
hol_tgt_data=pd.read_parquet(f"{repo}/{path}/holdout-target.pqt"),
hol_ctx_data=pd.read_parquet(f"{repo}/{path}/holdout-context.pqt"),
tgt_context_key="players_id",
ctx_primary_key="id",
report_subtitle=" for Baseball Seasons",
report_path="baseball-seasons-with-context.html",
)
print(metrics.model_dump_json(indent=4))
webbrowser.open(f"file://{report_path.absolute()}")
👉 HTML Report