Validator of algorithm results¶
This module validates the results returned by an algorithm.
- class encore.validators.algorithm_results.AnalysisOutput(*, enabled: bool = False, success: bool, results: ResultsBlock, answer: Dict[str, Any], engine_time: float = 0.0, algorithm_time: float = 0.0, update_params: Dict[str, Any] | None = {}, **extra_data: Any)¶
- algorithm_time: float¶
- answer: Dict[str, Any]¶
- enabled: bool¶
- engine_time: float¶
- model_config: ClassVar[ConfigDict] = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- results: ResultsBlock¶
- success: bool¶
- update_params: Dict[str, Any] | None¶
- validate_shapes_with_context(info)¶
Validate result matrix shapes using contextual neuron and timepoint information.
Checks that
results.neus_in_ensandresults.timecoursematch the expected shapes derived from the number of ensembles and the validation context (neuronsandtimepoints).
- class encore.validators.algorithm_results.ResultsBlock(*, ensembles_cant: int, timecourse: ndarray, neus_in_ens: ndarray)¶
- ensembles_cant: int¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- neus_in_ens: ndarray¶
- timecourse: ndarray¶
- classmethod validate_binary_matrix(v: ndarray)¶
Validate that the input is a 2D binary NumPy array.
Ensures the array is a NumPy ndarray, has exactly two dimensions, and contains only binary values (0 or 1).
- encore.validators.algorithm_results.validate_analysis_output(output: dict, neurons: int, timepoints: int) AnalysisOutput¶
Validate and parse an analysis output dictionary.
Uses contextual information about neuron and timepoint counts to perform shape validation and returns a fully validated
AnalysisOutputmodel.- Parameters:
output (dict) – Raw analysis output dictionary.
neurons (int) – Expected number of neurons.
timepoints (int) – Expected number of timepoints.
- Raises:
RuntimeError – If validation fails.
- Returns:
Validated analysis output model.
- Return type: