How to use the skorch.dataset.Dataset function in skorch

To help you get started, we’ve selected a few skorch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skorch-dev / skorch / examples / word_language_model / train.py View on Github external
def my_train_split(ds, y):
    # Return (corpus.train, corpus.valid) in case the network
    # is fitted using net.fit(corpus.train).
    return ds, skorch.dataset.Dataset(corpus.valid[:200], y=None)
github fancompute / wavetorch / study / vowel_train_sklearn.py View on Github external
def my_train_split(ds, y):
    return ds, skorch.dataset.Dataset(corpus.valid[:200], y=None)
github skorch-dev / skorch / skorch / dataset.py View on Github external
def uses_placeholder_y(ds):
    """If ``ds`` is a ``skorch.dataset.Dataset`` or a
    ``skorch.dataset.Dataset`` nested inside a
    ``torch.utils.data.Subset`` and uses
    y as a placeholder, return ``True``."""

    if isinstance(ds, torch.utils.data.Subset):
        return uses_placeholder_y(ds.dataset)
    return isinstance(ds, Dataset) and hasattr(ds, "y") and ds.y is None
github skorch-dev / skorch / skorch / utils.py View on Github external
def is_skorch_dataset(ds):
    """Checks if the supplied dataset is an instance of
    ``skorch.dataset.Dataset`` even when it is nested inside
    ``torch.util.data.Subset``."""
    from skorch.dataset import Dataset
    if isinstance(ds, Subset):
        return is_skorch_dataset(ds.dataset)
    return isinstance(ds, Dataset)