示例#1
0
文件: test_kas.py 项目: yinxx/ATHENA
 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')
示例#2
0
文件: test_kas.py 项目: yinxx/ATHENA
 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$'])
示例#3
0
文件: test_kas.py 项目: yinxx/ATHENA
 def test_plot_eigenvectors_01(self):
     ss = KernelActiveSubspaces(dim=2)
     with self.assertRaises(TypeError):
         ss.plot_eigenvectors(figsize=(7, 7), title='Eigenvalues')