class BaseClassificationResults(BaseEvaluationResults): (source)
Known subclasses: fiftyone.utils.eval.classification.ClassificationResults
, fiftyone.utils.eval.detection.DetectionResults
, fiftyone.utils.eval.segmentation.SegmentationResults
Constructor: BaseClassificationResults(samples, config, eval_key, ytrue, ...)
Base class for evaluation results that expose classification metrics like P/R/F1 and confusion matrices.
Parameters | |
samples | the fiftyone.core.collections.SampleCollection used |
config | the fiftyone.core.evaluation.EvaluationMethodConfig
used |
eval | the evaluation key |
ytrue | a list of ground truth labels |
ypred | a list of predicted labels |
confs | an optional list of confidences for the predictions |
weights | an optional list of sample weights |
ytrue | a list of IDs for the ground truth labels |
ypred | a list of IDs for the predicted labels |
classes | the list of possible classes. If not provided, the observed ground truth/predicted labels are used |
missing | a missing label string. Any None-valued labels are given this label for evaluation purposes |
custom | an optional dict of custom metrics |
backend | a fiftyone.core.evaluation.EvaluationMethod
backend |
Method | __init__ |
Undocumented |
Method | confusion |
Generates a confusion matrix for the results via sklearn:sklearn.metrics.confusion_matrix . |
Method | metrics |
Computes classification metrics for the results, including accuracy, precision, recall, and F-beta score. |
Method | plot |
Plots a confusion matrix for the evaluation results. |
Method | print |
Prints the metrics computed via metrics . |
Method | print |
Prints a classification report for the results via sklearn:sklearn.metrics.classification_report . |
Method | report |
Generates a classification report for the results via sklearn:sklearn.metrics.classification_report . |
Instance Variable | classes |
Undocumented |
Instance Variable | confs |
Undocumented |
Instance Variable | missing |
Undocumented |
Instance Variable | weights |
Undocumented |
Instance Variable | ypred |
Undocumented |
Instance Variable | ypred |
Undocumented |
Instance Variable | ytrue |
Undocumented |
Instance Variable | ytrue |
Undocumented |
Class Method | _from |
Subclass implementation of from_dict . |
Method | _confusion |
Undocumented |
Method | _parse |
Undocumented |
Inherited from BaseEvaluationResults
:
Method | _get |
Undocumented |
Method | _print |
Undocumented |
Inherited from BaseRunResults
(via BaseEvaluationResults
, EvaluationResults
):
Class Method | from |
Builds a BaseRunResults from a JSON dict representation of it. |
Static Method | base |
Returns the results class for the given run type. |
Method | attributes |
Returns the list of class attributes that will be serialized by serialize . |
Method | save |
Saves the results to the database. |
Method | save |
Saves these results config to the database. |
Property | cls |
The fully-qualified name of this BaseRunResults class. |
Property | config |
The BaseRunConfig for these results. |
Property | key |
The run key for these results. |
Property | samples |
The fiftyone.core.collections.SampleCollection associated with these results. |
Instance Variable | _backend |
Undocumented |
Instance Variable | _config |
Undocumented |
Instance Variable | _key |
Undocumented |
Instance Variable | _samples |
Undocumented |
Generates a confusion matrix for the results via
sklearn:sklearn.metrics.confusion_matrix
.
The rows of the confusion matrix represent ground truth and the columns represent predictions.
Parameters | |
classes:None | an optional list of classes to include in the confusion matrix |
includeFalse | whether to include an extra row/column at the end of the matrix for labels that do not appear in classes. Only applicable if classes are provided |
includeFalse | whether to include a row/column at the end of the matrix for unmatched labels. Only applicable if self.missing does not already appear in classes. If both "other" and "missing" rows/columns are requested, this one is last |
Returns | |
a num_classes x num_classes confusion matrix |
Computes classification metrics for the results, including accuracy, precision, recall, and F-beta score.
See sklearn:sklearn.metrics.precision_recall_fscore_support
for
details.
Also includes any custom metrics from custom_metrics
.
Parameters | |
classes:None | an optional list of classes to include in the calculations |
average:"micro" | the averaging strategy to use |
beta:1.0 | the F-beta value to use |
Returns | |
a dict |
Plots a confusion matrix for the evaluation results.
If you are working in a notebook environment with the default plotly
backend, this method returns an interactive
fiftyone.core.plots.plotly.InteractiveHeatmap
that you can
attach to an App session via its
fiftyone.core.session.Session.plots
attribute, which will
automatically sync the session's view with the currently selected cells
in the confusion matrix.
Parameters | |
classes:None | an optional list of classes to include in the confusion matrix |
includeNone | whether to include a row/column for examples whose label is in classes but are matched to labels that do not appear in classes. Only applicable if classes are provided. The supported values are:
|
includeNone | whether to include a row/column for missing ground truth/predictions in the confusion matrix. The supported values are:
|
other | the label to use for "other" predictions |
backend:"plotly" | the plotting backend to use. Supported values are ("plotly", "matplotlib") |
**kwargs | keyword arguments for the backend plotting method:
|
Returns | |
one of the following |
|
Prints a classification report for the results via
sklearn:sklearn.metrics.classification_report
.
Parameters | |
classes:None | an optional list of classes to include in the report |
digits:2 | the number of digits of precision to print |
Generates a classification report for the results via
sklearn:sklearn.metrics.classification_report
.
Parameters | |
classes:None | an optional list of classes to include in the report |
Returns | |
a dict |
fiftyone.utils.eval.classification.ClassificationResults
, fiftyone.utils.eval.detection.DetectionResults
Undocumented
fiftyone.utils.eval.classification.BinaryClassificationResults
, fiftyone.utils.eval.detection.DetectionResults
, fiftyone.utils.eval.segmentation.SegmentationResults
Subclass implementation of from_dict
.
Parameters | |
d | a JSON dict |
samples | the fiftyone.core.collections.SampleCollection
for the run |
config | the BaseRunConfig for the run |
eval | Undocumented |
key | the run key |
**kwargs | Undocumented |
Returns | |
a BaseRunResults |
Undocumented