def __data_preparation(self, path_input_dir, N): assert os.path.exists(path_input_dir) assert isinstance(N, int) list_of_path = data_loader.make_path_pic_list(path_input_dir) index_datapath_mapper, dataset = data_loader.make_data_matrix(list_of_input_files=list_of_path) self.dataset = dataset self.index_datapath_mapper = index_datapath_mapper train_test_object = data_loader.split_data_train_and_test(self.dataset, N) self.y_train = train_test_object['train'] self.y_test = train_test_object['test'] self.N_test = train_test_object['N_test'] if self.is_add_noise==True: x_train = self.add_noise(train_set=train_test_object['train'], noise_ratio=self.noise_rate) x_test = self.add_noise(train_set=train_test_object['test'], noise_ratio=self.noise_rate) n_dimension = x_train.shape[1] else: x_train = train_test_object['train'] x_test = train_test_object['test'] n_dimension = x_train.shape[1] assert isinstance(x_train, np.ndarray) assert isinstance(x_test, np.ndarray) assert len(x_train.shape) == 2 assert len(x_test.shape) == 2 self.x_train = x_train self.x_test = x_test self.n_dimension = n_dimension
def exp_interface(): """make dataset for pylearn2 from girls' face gray scaled pictures :return: """ path_index_path = '../../extracted/miss_collection/gray' input_files_list = data_loader.make_path_pic_list(path_input_dir=path_index_path) path_to_save_directory = 'intermediate_files_pylearn2' project_name = 'toy_train' main(input_files_list, path_to_save_directory, project_name)