Context#

class Context[source]#

Contains all the data + properties the user has passed to a check/suite, and validates it seamlessly.

Parameters
trainVisionData , default: None

Dataset or DataFrame object, representing data an estimator was fitted on

testVisionData , default: None

Dataset or DataFrame object, representing data an estimator predicts on

modelBasicModel , default: None

A scikit-learn-compatible fitted estimator instance

model_name: str , default: ‘’

The name of the model

scorersMapping[str, Metric] , default: None

dict of scorers names to a Metric

scorers_per_classMapping[str, Metric] , default: None

dict of scorers for classification without averaging of the classes. See <a href= “https://scikit-learn.org/stable/modules/model_evaluation.html#from-binary-to-multiclass-and-multilabel”> scikit-learn docs</a>

deviceUnion[str, torch.device], default: ‘cpu’

processing unit for use

random_stateint

A seed to set for pseudo-random functions

n_samplesint, default: None
__init__(train: Optional[VisionData] = None, test: Optional[VisionData] = None, model: Optional[Module] = None, model_name: str = '', scorers: Optional[Mapping[str, Metric]] = None, scorers_per_class: Optional[Mapping[str, Metric]] = None, device: Optional[Union[str, device]] = None, random_state: int = 42, n_samples: Optional[int] = None, train_predictions: Optional[Union[List[Tensor], Tensor]] = None, test_predictions: Optional[Union[List[Tensor], Tensor]] = None)[source]#
__new__(*args, **kwargs)#

Attributes

Context.device

Return device specified by the user.

Context.model

Return & validate model if model exists, otherwise raise error.

Context.model_name

Return model name.

Context.static_predictions

Return the static_predictions.

Context.test

Return test if exists, otherwise raise error.

Context.train

Return train if exists, otherwise raise error.

Methods

Context.assert_predictions_valid([kind])

Assert that for given DatasetKind the model & dataset infer_on_batch return predictions in right format.

Context.assert_task_type(*expected_types)

Assert task_type matching given types.

Context.get_data_by_kind(kind)

Return the relevant VisionData by given kind.

Context.get_is_sampled_footnote([kind])

Get footnote to display when the datasets are sampled.

Context.have_test()

Return whether there is test dataset defined.