コード例 #1
0
def test_interaction_on_arrays():
    # test inputs
    a = np.array([1, 0.5, 1. / 3, 0, 0.5, 1])
    b = np.array([2, 0.75, 1, 2, 2.5, 4])

    # expected interaction
    c = np.array([1, 0.25, 0.67, 4, 4, 9])

    assert_array_almost_equal(interaction(a, b), c, 2)
コード例 #2
0
def test_interaction_on_arrays():
  # test inputs
  a = np.array([1, 0.5,  1. / 3, 0, 0.5, 1])
  b = np.array([2, 0.75, 1,      2, 2.5, 4])

  # expected interaction
  c = np.array([1, 0.25, 0.67, 4, 4, 9])

  assert_array_almost_equal(interaction(a, b), c, 2)
コード例 #3
0
def test_symmetric_on_arrays():
    for a in np.arange(30).reshape((6, 5)):
        for b in np.arange(-3, 27).reshape((6, 5)):
            assert_array_almost_equal(interaction(a, b), interaction(b, a))
コード例 #4
0
def test_symmetric():
    for a in range(3):
        for b in range(-3, 2):
            assert_equals(interaction(a, b), interaction(b, a))
コード例 #5
0
def test_far_interaction():
   assert_equals(interaction(0, 2), 4)
   assert_equals(interaction(0.5, 2.5), 4)
   assert_equals(interaction(1, 4), 9)
コード例 #6
0
def test_close_interaction():
   assert_equals(interaction(1, 2), 1)
   assert_equals(interaction(0.5, 0.75), 0.25)
   assert_almost_equals(interaction(1. / 3, 1), 0.67, 2)
コード例 #7
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_far_interaction():
   assert interaction(0, 2) == 4
   assert interaction(0.5, 2.5) == 4
   assert interaction(1, 4) == 9
コード例 #8
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_close_interaction():
   assert interaction(1, 2) == 1
   assert interaction(0.5, 0.75) == 0.25
コード例 #9
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_symmetric():
    for a in range(3):
        for b in range(-3, 2):
            assert interaction(a, b) == interaction(b, a)
コード例 #10
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_close_interaction():
    assert_equals(interaction(1, 2), 1)
    assert_equals(interaction(0.5, 0.75), 0.25)
    assert_almost_equals(interaction(1. / 3, 1), 0.67, 2)
コード例 #11
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_symmetric():
    for a in range(3):
        for b in range(-3, 2):
            assert_equals(interaction(a, b), interaction(b, a))
コード例 #12
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_far_interaction():
    assert_equals(interaction(0, 2), 4)
    assert_equals(interaction(0.5, 2.5), 4)
    assert_equals(interaction(1, 4), 9)
コード例 #13
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_far_interaction():
    assert interaction(0, 2) == 4
    assert interaction(0.5, 2.5) == 4
    assert interaction(1, 4) == 9
コード例 #14
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_close_interaction():
    assert interaction(1, 2) == 1
    assert interaction(0.5, 0.75) == 0.25
コード例 #15
0
ファイル: test_nonlinear.py プロジェクト: NelleV/SCCourses
def test_symmetric():
    for a in range(3):
        for b in range(-3, 2):
            assert interaction(a, b) == interaction(b, a)
コード例 #16
0
def test_symmetric_on_arrays():
    for a in np.arange(30).reshape((6, 5)):
        for b in np.arange(-3, 27).reshape((6, 5)):
            assert_array_almost_equal(interaction(a, b), interaction(b, a))