matchzoo.datasets.toy
¶
Package Contents¶
-
class
matchzoo.datasets.toy.
BaseTask
(losses=None, metrics=None)¶ Bases:
abc.ABC
Base Task, shouldn’t be used directly.
-
TYPE
= base¶
-
losses
¶ Losses used in the task.
Type: return
-
metrics
¶ Metrics used in the task.
Type: return
-
output_shape
:tuple¶ output shape of a single sample of the task.
Type: return
-
output_dtype
¶ output data type for specific task.
Type: return
-
_convert
(self, identifiers, parse)¶
-
_assure_losses
(self)¶
-
_assure_metrics
(self)¶
-
classmethod
list_available_losses
(cls)¶ Returns: a list of available losses.
-
classmethod
list_available_metrics
(cls)¶ Returns: a list of available metrics.
-
-
matchzoo.datasets.toy.
load_data
(stage: str = 'train', task: typing.Union[str, BaseTask] = 'ranking', return_classes: bool = False) → typing.Union[matchzoo.DataPack, typing.Tuple[matchzoo.DataPack, list]]¶ Load toy data.
Parameters: - stage – One of train, dev, and test.
- task – Could be one of ranking, classification or a
matchzoo.engine.BaseTask
instance. - return_classes – True to return classes for classification task, False otherwise.
Returns: A DataPack unless task is classificiation and return_classes is True: a tuple of (DataPack, classes) in that case.
Example
>>> import matchzoo as mz >>> stages = 'train', 'dev', 'test' >>> tasks = 'ranking', 'classification' >>> for stage in stages: ... for task in tasks: ... _ = mz.datasets.toy.load_data(stage, task)
-
matchzoo.datasets.toy.
load_embedding
()¶