def test_concat(self): dmd1 = self.get_data(is_classification=False) dmd2 = self.get_data(is_classification=True) self.assertEqual(dmd1.n_samples, dmd2.n_samples) dmd = DMD.concat([dmd1, dmd2], axis=0) self.assertEqual(dmd.n_samples, 2 * dmd2.n_samples) self.assertEqual(dmd._x.shape[0], 2 * dmd1._y.shape[0]) self.assertEqual(dmd._x.shape[0], 2 * dmd1._samples_meta.shape[0]) self.assertEqual(dmd.n_features, dmd2.n_features)
def prepare_dataset_for_score_quality(cls, dmd_train: DMD, dmd_test: DMD): ''' :param dmd_train: train set :param dmd_test: test set :return: dataset with target of test/train ''' dmd = DMD.concat([dmd_train, dmd_test]) new_label = [0] * dmd_train.n_samples + [1] * dmd_test.n_samples dmd.set_target(new_label) train, test = dmd.split(ratio=dmd_test.n_samples / (dmd_train.n_samples + dmd_test.n_samples)) return train, test