Skip to content

Commit 5f3ef67

Browse files
cli
1 parent e76c558 commit 5f3ef67

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/cardvalue_ml/models/experiments.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@
33
from __future__ import annotations
44

55
import datetime as dt
6+
import importlib
67
from pathlib import Path
7-
from typing import Any
8+
from typing import Any, cast
89

910
import pandas as pd
10-
import yaml # type: ignore[import-untyped]
1111

1212
from cardvalue_ml.config import paths
1313
from cardvalue_ml.features.build_features import prepare_regression_features
1414
from cardvalue_ml.models.evaluate import save_json
1515
from cardvalue_ml.models.train import train_random_forest
1616

17+
yaml = cast(Any, importlib.import_module("yaml"))
18+
1719

1820
def load_experiment_config(config_path: Path) -> dict[str, Any]:
1921
if not config_path.exists():
@@ -22,7 +24,7 @@ def load_experiment_config(config_path: Path) -> dict[str, Any]:
2224
config = yaml.safe_load(handle)
2325
if not isinstance(config, dict):
2426
raise ValueError("Experiment config must be a mapping")
25-
return config
27+
return cast(dict[str, Any], config)
2628

2729

2830
def run_experiment(config_path: Path) -> dict[str, Any]:

0 commit comments

Comments
 (0)