def test_load_data_covertype(): from deephyper.benchmark.datasets import covertype import numpy as np names = ["train", "valid", "test"] data = covertype.load_data(random_state=42) for (X, y), subset_name in zip(data, names): print( f"X_{subset_name} shape: ", np.shape(X), f", y_{subset_name} shape: ", np.shape(y), )
def load_data_cache(): # Random state random_state = np.random.RandomState(seed=42) (X_train, y_train), (X_valid, y_valid), _ = covertype.load_data( random_state=random_state ) prepro_output = preprocessing.OneHotEncoder() y_train = y_train.reshape(-1, 1) y_valid = y_valid.reshape(-1, 1) y_train = prepro_output.fit_transform(y_train).toarray() y_valid = prepro_output.transform(y_valid).toarray() prepro_input = minmaxstdscaler() X_train = prepro_input.fit_transform(X_train) X_valid = prepro_input.transform(X_valid) print(f"X_train shape: {np.shape(X_train)}") print(f"y_train shape: {np.shape(y_train)}") print(f"X_valid shape: {np.shape(X_valid)}") print(f"y_valid shape: {np.shape(y_valid)}") return (X_train, y_train), (X_valid, y_valid)
def load_data(): train, valid, _ = covertype.load_data(random_state=42) return train, valid