AnswerItem#

class scikitplot.corpus.AnswerItem(item_id, question, answer, scores, n_contexts=None, latency_s=0.0, error=None, judgments=<factory>)[source]#

One item of an AnswerEvaluation.

Parameters:
item_idstr or int

Item identifier.

questionstr

The question.

answerstr or None

The evaluated answer; None when the system failed.

scoresmapping

Metric name to score (NaN when undefined or failed).

n_contextsint or None, default=None

Contexts the judges saw (None: no contexts).

latency_sfloat, default=0.0

Seconds the system took (0.0 for stored answers).

errorstr or None, default=None

Why the system produced no answer.

judgmentsmapping, default={}

{metric: {judge: JudgeResult}}, when verdicts are kept.

Parameters:
answer: str | None[source]#
error: str | None = None#
classmethod from_dict(data)[source]#

Rebuild from to_dict output.

Parameters:

data (Mapping[str, Any])

Return type:

AnswerItem

item_id: Any[source]#
judgments: Mapping[str, Mapping[str, JudgeResult]][source]#
latency_s: float = 0.0#
n_contexts: int | None = None#
question: str[source]#
scores: Mapping[str, float][source]#
to_dict()[source]#

Return a mapping in the report schema.

Return type:

dict[str, Any]