コード例 #1
0
ファイル: test_base.py プロジェクト: dnouri/nolearn
 def test_with_get_output_kw(self, objective, get_output):
     loss_function, target = Mock(), Mock()
     loss_function.return_value = np.array([1, 2, 3])
     objective(
         [1, 2, 3], loss_function=loss_function, target=target,
         get_output_kw={'i_was': 'here'},
         )
     get_output.assert_called_with(3, deterministic=False, i_was='here')
コード例 #2
0
 def test_with_get_output_kw(self, objective, get_output):
     loss_function, target = Mock(), Mock()
     loss_function.return_value = np.array([1, 2, 3])
     objective(
         [1, 2, 3], loss_function=loss_function, target=target,
         get_output_kw={'i_was': 'here'},
         )
     get_output.assert_called_with(3, deterministic=False, i_was='here')
コード例 #3
0
ファイル: test_base.py プロジェクト: dnouri/nolearn
 def test_with_defaults(self, objective, get_output):
     loss_function, target = Mock(), Mock()
     loss_function.return_value = np.array([1, 2, 3])
     result = objective(
         [1, 2, 3], loss_function=loss_function, target=target)
     assert result == 2.0
     get_output.assert_called_with(3, deterministic=False)
     loss_function.assert_called_with(get_output.return_value, target)
コード例 #4
0
 def test_with_defaults(self, objective, get_output):
     loss_function, target = Mock(), Mock()
     loss_function.return_value = np.array([1, 2, 3])
     result = objective(
         [1, 2, 3], loss_function=loss_function, target=target)
     assert result == 2.0
     get_output.assert_called_with(3, deterministic=False)
     loss_function.assert_called_with(get_output.return_value, target)