langcheck.metrics.metric_value#
- class langcheck.metrics.metric_value.MetricValue(metric_name: str, metric_values: list[NumericType], metric_inputs: MetricInputs, explanations: list[str | None] | None, language: str | None)[source]#
Bases:
Generic
[NumericType
]A rich object that is the output of any langcheck.metrics function.
- all() bool [source]#
Equivalent to all(metric_value.metric_values). This is mostly useful for binary metric functions.
- any() bool [source]#
Equivalent to any(metric_value.metric_values). This is mostly useful for binary metric functions.
- explanations: list[str | None] | None#
- histogram(jupyter_mode: str = 'inline') None [source]#
Shows an interactive histogram of all data points in MetricValue. Intended to be used in a Jupyter notebook.
This is a convenience function that calls
langcheck.plot.histogram()
.
- property is_scatter_compatible: bool#
Checks if the metric value is compatible with the scatter plot method. It is only available for metric values with only non-pairwise metric values used from initial release (generated_outputs, prompts, reference_outputs and sources)
- language: str | None#
- metric_inputs: MetricInputs#
- metric_name: str#
- metric_values: list[NumericType]#
- scatter(jupyter_mode: str = 'inline') None [source]#
Shows an interactive scatter plot of all data points in MetricValue. Intended to be used in a Jupyter notebook.
This is a convenience function that calls
langcheck.plot.scatter()
.
- class langcheck.metrics.metric_value.MetricValueWithThreshold(metric_name: str, metric_values: list[NumericType], metric_inputs: MetricInputs, explanations: list[str | None] | None, language: str | None, threshold: float | int, threshold_op: str)[source]#
Bases:
MetricValue
A rich object that is the output of comparing an
MetricValue
object, e.g. metric_value >= 0.5.- property pass_rate: float#
Returns the proportion of data points that pass the threshold.
- threshold: float | int#
- threshold_op: str#
- property threshold_results: list[bool]#
Returns a list of booleans indicating whether each data point passes the threshold.