def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.random_state = np.random.RandomState(0) self.error_tol = 1e-6 self.X, self.Y = get_dataset(return_X_y=True) # for the sake of expedience, only use a subset of the dataset idx = self.random_state.choice(len(self.X), 1000) self.X = self.X[idx] self.Y = self.Y[idx] # artificial second property self.Y = np.array([ self.Y, self.X @ self.random_state.randint(-2, 2, (self.X.shape[-1], )) ]).T self.Y = self.Y.reshape(self.X.shape[0], -1) self.X = SFS().fit_transform(self.X) self.Y = SFS(column_wise=True).fit_transform(self.Y) self.model = lambda mixing=0.5, regressor=KernelRidge( alpha=1e-8), **kwargs: KernelPCovR(mixing, regressor=regressor, svd_solver=kwargs.pop( "svd_solver", "full"), **kwargs)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.model = lambda mixing=0.5, regressor=Ridge( alpha=1e-8, fit_intercept=False, tol=1e-12), **kwargs: PCovR( mixing, regressor=regressor, **kwargs) self.error_tol = 1e-5 self.X, self.Y = get_dataset(return_X_y=True) self.X = StandardScaler().fit_transform(self.X) self.Y = StandardScaler().fit_transform(np.vstack(self.Y))
def test_bad_y(self): self.X, self.Y = get_dataset(return_X_y=True) selector = GreedyTester(n_to_select=2) with self.assertRaises(ValueError): selector.fit(X=self.X, y=self.Y[:2])
def setUp(self): self.X, _ = get_dataset(return_X_y=True)
def setUp(self): self.X, _ = get_dataset(return_X_y=True) self.idx = [0, 123, 441, 187, 117, 276, 261, 281, 251, 193]
def setUp(self): self.X, _ = get_dataset(return_X_y=True) self.idx = [0, 6, 1, 2, 4, 9, 3]
def setUp(self): self.X, self.y = get_dataset(return_X_y=True) self.idx = [2, 8, 3, 4, 1, 7, 5, 9, 6]
def setUp(self): self.X, self.y = get_dataset(return_X_y=True) self.idx = [0, 256, 156, 324, 349, 77, 113, 441, 426, 51]
def setUp(self): self.X, self.y = get_dataset(return_X_y=True) self.idx = [256, 304, 58, 10, 23, 278, 230, 285, 291, 357]
def setUp(self): self.X, self.y = get_dataset(return_X_y=True) self.idx = [0, 2, 6, 7, 1, 3, 4]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.X, self.Y = get_dataset(return_X_y=True)