def test_plot_eigenvectors_02(self): np.random.seed(42) gradients = np.random.uniform(-1, 1, 200).reshape(50, 1, 4) inputs = np.random.uniform(-1, 1, 200).reshape(50, 4) weights = np.ones((50, 1)) / 50 ss = KernelActiveSubspaces(dim=2, n_features=8, method='exact', n_boot=5) ss.fit(inputs=inputs, gradients=gradients, weights=weights) with assert_plot_figures_added(): ss.plot_eigenvectors(n_evects=2, figsize=(7, 7), title='Eigenvectors')
def test_plot_eigenvectors_03(self): np.random.seed(42) gradients = np.random.uniform(-1, 1, 200).reshape(50, 1, 4) inputs = np.random.uniform(-1, 1, 200).reshape(50, 4) weights = np.ones((50, 1)) / 50 ss = KernelActiveSubspaces(dim=2, n_features=5, method='exact', n_boot=5) ss.fit(inputs=inputs, gradients=gradients, weights=weights) with assert_plot_figures_added(): ss.plot_eigenvectors(n_evects=2, figsize=(5, 8), labels=[r'$x$', r'$y$', 'q', r'$r$', r'$z$'])
def test_plot_eigenvectors_01(self): ss = KernelActiveSubspaces(dim=2) with self.assertRaises(TypeError): ss.plot_eigenvectors(figsize=(7, 7), title='Eigenvalues')