maskit.datasets package

Submodules

maskit.datasets.circles module

maskit.datasets.circles.circles(train_size=100, test_size=50, shuffle=True) DataSet

maskit.datasets.iris module

maskit.datasets.iris.iris(train_size=100, test_size=50, shuffle=True) DataSet

maskit.datasets.mnist module

maskit.datasets.mnist.apply_PCA(wires: int, x_train: ndarray)
maskit.datasets.mnist.convert_label(y: int, classes: List[int]) List[float]
maskit.datasets.mnist.downscale(x_data, y_data, size) Tuple[ndarray, ndarray]

This function does several things including the reduction of image size, conversion to binary as well as removal of duplicates.

Parameters:
  • x_data – Input data

  • y_data – Target data

  • size – Maximum number of data to prepare

maskit.datasets.mnist.mnist(wires: int = 4, classes=(6, 9), train_size: int = 100, validation_size: int = 0, test_size: int = 50, shuffle: Union[bool, int] = 1337) DataSet
maskit.datasets.mnist.prepare_data(x_data: ndarray, y_data: ndarray, size, classes) Tuple[ndarray, ndarray]
maskit.datasets.mnist.reduce_image(x: ndarray) ndarray

maskit.datasets.utils module

class maskit.datasets.utils.DataSet(train_data, train_target, validation_data, validation_target, test_data, test_target)

Bases: tuple

property test_data

Alias for field number 4

property test_target

Alias for field number 5

property train_data

Alias for field number 0

property train_target

Alias for field number 1

property validation_data

Alias for field number 2

property validation_target

Alias for field number 3

maskit.datasets.utils.one_hot(a: ndarray, num_classes: int) ndarray
maskit.datasets.utils.pad_data(data: ndarray, axis: int, padding: int) ndarray

Function pads 0 data to the end of the given axis.

Parameters:
  • data – The data to pad 0 data to

  • axis – Axis to pad on

  • padding – How many elements to pad

Module contents

maskit.datasets.load_data(dataset: str, train_size: int = 100, test_size: int = 50, validation_size: int = 0, shuffle: Union[bool, int] = 1337, classes: Tuple[int, ...] = (6, 9), wires: int = 4, target_length: Optional[int] = None) DataSet

Returns the data for the requested dataset.

Parameters:
  • dataset – Name of the chosen dataset. Available datasets are: iris, mnist and circles.

  • train_size – Size of the training dataset

  • test_size – Size of the testing dataset

  • shuffle – if the dataset should be shuffled, used also as a seed

  • classes – which numbers of the mnist dataset should be included

  • wires – number of wires in the circuit

  • target_length – Normalised length of target arrays

Raises:

ValueError – Raised if a not supported dataset is requested