def _load_data(self): # pragma: no cover (x_train, y_train), (x_test, y_test) = fashion_mnist.load_data() train = Dataset(x_train, y_train, self.x_type, self.y_type) test = Dataset(x_test, y_test, self.x_type, self.y_type) return train, test, None
def _load_data(self): # pragma: no cover (x_train, y_train), (x_test, y_test) = boston_housing.load_data() train = Dataset(x_train, y_train, self.x_type, self.y_type) test = Dataset(x_test, y_test, self.x_type, self.y_type) return train, test, None
def _load_data(self): train = Dataset(np.array([1]), np.array([10]), self.x_type, self.y_type) test = Dataset(np.array([2]), np.array([20]), self.x_type, self.y_type) validation = Dataset( np.array([3]), np.array([30]), self.x_type, self.y_type ) return train, test, validation
def __init__(self, parent: "QObject" = None): super().__init__(parent) self.max_row_batch_to_load = 100 self._dataset: "Dataset" = Dataset() self._types: List[Optional[DataType]] = [ self._dataset.x_type, self._dataset.y_type, ] self._loaded_types: List[Dict[str, DataType]] = [ { type(self._dataset.x_type).__name__: self._dataset.x_type }, { type(self._dataset.y_type).__name__: self._dataset.y_type }, ] self._cached_data: List[List[Any]] = [[], []] self._role_map = { Qt.DisplayRole: self._display_role, self.TypeRole: self._type_role, }
def simple_categorical_dataset(): return Dataset( x_data=np.array([0, 1, 2]), y_data=np.array([0, 1, 2]), x_type=Numeric(), y_type=Categorical(["foo", "bar", "hue"]), )
def simple_numeric_dataset(): return Dataset( x_data=np.array([1, 2, 3, 4]), y_data=np.array([10, 20, 30, 40]), x_type=Numeric(), y_type=Numeric(), )
def test_dataset(): return Dataset( x_data=np.array( [np.array([1, 1, 1]), np.array([2, 2, 2]), np.array([3, 3, 3])]), y_data=np.array([1, 2, 3]), x_type=NumericArray(), y_type=Numeric(), )
def load(self, parent_dir: str) -> "Dataset": """Loads the dataset from the specified `dataset_description` object. A `parent_dir` must be passed to resolve relative paths on the `dataset_description`. Returns: The loaded dataset. """ x_type = self.get_x_type() y_type = self.get_y_type() # Dataset data (x, y) must be filled by subclasses overriding this method return Dataset(x_type=x_type, y_type=y_type)
def _load_data(self): # pragma: no cover (x_train, y_train), (x_test, y_test) = cifar10.load_data() train = Dataset(x_train, y_train, self.x_type, self.y_type) test = Dataset(x_test, y_test, self.x_type, self.y_type) train.y = np.array( [train.y_type.convert_to_expected_format(i) for i in train.y]) test.y = np.array( [test.y_type.convert_to_expected_format(i) for i in test.y]) return train, test, None
def empty_dataset(): return Dataset()