mixle.data.validate module¶
Check that a dataset conforms to the spec a model expects, before fitting.
check_dataset(model, data) derives the model’s schema (mixle.data.schema.Schema.for_model()) and,
over a sample of records, verifies each record (a) coerces to the schema’s logical types and (b) lies in
the model’s support (finite log-density). It returns a report (and can raise on failure) so an invalid
feed – wrong column types, out-of-support values, malformed records – is caught up front rather than
surfacing later as a non-finite likelihood or a cryptic error deep in EM.
- class DataReport(ok, n_checked, schema, issues=<factory>)[source]
Bases:
objectResult of checking sample records against a model-derived schema and support.
- check_dataset(model, data, *, sample=1000, check_support=True, raise_on_error=False)[source]
Validate
dataagainst the schema/supportmodelexpects (over the firstsamplerecords).Records both type-coercion failures (wrong shape/dtype for a field) and, when
check_supportis True, support violations (a value the model assigns probability 0 ->-inflog-density). Withraise_on_errorthe first batch of issues is raised as aValueError.