MCPcopy Create free account
hub / github.com/Open-Quant/openquant / _as_matrix

Function _as_matrix

python/openquant/feature_diagnostics.py:21–30  ·  view source on GitHub ↗
(x: Sequence[Sequence[float]])

Source from the content-addressed store, hash-verified

19
20
21def _as_matrix(x: Sequence[Sequence[float]]) -> list[list[float]]:
22 rows = [list(map(float, r)) for r in x]
23 if not rows:
24 raise ValueError("X cannot be empty")
25 width = len(rows[0])
26 if width == 0:
27 raise ValueError("X must contain at least one feature")
28 if any(len(r) != width for r in rows):
29 raise ValueError("X must be rectangular")
30 return rows
31
32
33def _as_vector(y: Sequence[float], n_rows: int) -> list[float]:

Callers 5

mdi_importanceFunction · 0.85
mda_importanceFunction · 0.85
sfi_importanceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected