コード例 #1
0
 def test_cross_validation_fit_02(self):
     np.random.seed(42)
     inputs = np.random.uniform(-1, 1, 15).reshape(5, -1)
     outputs = np.random.uniform(0, 5, 10).reshape(5, -1)
     gradients = np.random.uniform(-1, 1, 30).reshape(5, 2, 3)
     ss = ActiveSubspaces(dim=1)
     csv = CrossValidation(inputs=inputs,
                           outputs=outputs,
                           gradients=gradients,
                           folds=3,
                           subspace=ss)
     csv.fit(inputs, gradients, outputs)
     self.assertIsNotNone(csv.gp)
コード例 #2
0
 def test_cross_validation_fit_01(self):
     np.random.seed(42)
     inputs = np.random.uniform(-1, 1, 15).reshape(5, -1)
     outputs = np.random.uniform(0, 5, 10).reshape(5, -1)
     gradients = np.random.uniform(-1, 1, 30).reshape(5, 2, 3)
     ss = ActiveSubspaces(dim=2, method='exact')
     csv = CrossValidation(inputs=inputs,
                           outputs=outputs,
                           gradients=gradients,
                           folds=3,
                           subspace=ss)
     csv.fit(inputs, gradients, outputs)
     self.assertEqual(csv.gp.X.shape[1], 2)