hxtorch.spiking.datasets.yinyang.YinYangDataset

class hxtorch.spiking.datasets.yinyang.YinYangDataset(r_small: float = 0.1, r_big: float = 0.5, size: int = 1000, seed: int = 42, transform: Optional[torch.nn.modules.module.Module] = None)

Bases: Generic[torch.utils.data.dataset.T_co]

YinYang dataset

__init__(r_small: float = 0.1, r_big: float = 0.5, size: int = 1000, seed: int = 42, transform: Optional[torch.nn.modules.module.Module] = None)None

Instantiate the YinYang dataset. This dataset provides data points on a 2-dimensional plane within a yin-yang sign. Each data point is assigned to one of three classes: The eyes, the yin or the yang. :param r_small: The radius of the eyes in the yin-yang sign. :param r_big: The radius of the whole sign. :param size: The size of the dataset, i.e. number of data points within

the sign.

Parameters
  • seed – Random seed.

  • transform – An optional transformation applied to the returned samples.

Methods

__init__([r_small, r_big, size, seed, transform])

Instantiate the YinYang dataset. This dataset provides data points on a 2-dimensional plane within a yin-yang sign. Each data point is assigned to one of three classes: The eyes, the yin or the yang. :param r_small: The radius of the eyes in the yin-yang sign. :param r_big: The radius of the whole sign. :param size: The size of the dataset, i.e. number of data points within the sign. :param seed: Random seed. :param transform: An optional transformation applied to the returned samples.

dist_to_left_dot(x, y)

Compute the distance to the left dot.

dist_to_right_dot(x, y)

Compute the distance to the right dot.

get_sample([goal])

Sample one data point from the yin-yang sign with goal class goal. If goal is None any sample of any class is returned. :param goal: The target class of the sample to return. If None is given, any sample regardless of its class is returned. :returns: Returns a tuple (x coordinate, y coordinate, class), where the coordinates are on the xy-plane.

which_class(x, y)

Assign a sample on the xy-plane with coordinates (x, y) to its class.

dist_to_left_dot(x: int, y: int)float

Compute the distance to the left dot. :param x: The x-coordinate. :param y: The y-coordinate. :returns: Returns the distance to the left dot.

dist_to_right_dot(x: int, y: int)float

Compute the distance to the right dot. :param x: The x-coordinate. :param y: The y-coordinate. :returns: Returns the distance to the right dot.

get_sample(goal: Optional[int] = None)Tuple[float, ]

Sample one data point from the yin-yang sign with goal class goal. If goal is None any sample of any class is returned. :param goal: The target class of the sample to return. If None is

given, any sample regardless of its class is returned.

Returns

Returns a tuple (x coordinate, y coordinate, class), where the coordinates are on the xy-plane.

which_class(x: float, y: float)int

Assign a sample on the xy-plane with coordinates (x, y) to its class. :param x: The x-coordinate. :param y: The y-coordinate. :returns: An integer indicating the samples class.