@@ -19,12 +19,12 @@ def add_noise(array, noise, seed):
1919@pytest .fixture
2020def case1 ():
2121 # m=1, q=1
22- def f (beta : np .ndarray , x : np .ndarray ) -> np .ndarray :
22+ def f (x : np .ndarray , beta : np .ndarray ) -> np .ndarray :
2323 return beta [0 ] + beta [1 ] * x + beta [2 ] * x ** 2 + beta [3 ] * x ** 3
2424
2525 beta_star = np .array ([1 , - 2. , 0.1 , - 0.1 ])
2626 x = np .linspace (- 10. , 10. , 21 )
27- y = f (beta_star , x )
27+ y = f (x , beta_star )
2828
2929 x = add_noise (x , 5e-2 , SEED )
3030 y = add_noise (y , 10e-2 , SEED )
@@ -35,13 +35,13 @@ def f(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
3535@pytest .fixture
3636def case2 ():
3737 # m=2, q=1
38- def f (beta : np .ndarray , x : np .ndarray ) -> np .ndarray :
38+ def f (x : np .ndarray , beta : np .ndarray ) -> np .ndarray :
3939 return (beta [0 ] * x [0 , :])** 3 + x [1 , :]** beta [1 ]
4040
4141 beta_star = np .array ([2. , 2. ])
4242 x1 = np .linspace (- 10. , 10. , 41 )
4343 x = np .vstack ((x1 , 10 + x1 / 2 ))
44- y = f (beta_star , x )
44+ y = f (x , beta_star )
4545
4646 x = add_noise (x , 5e-2 , SEED )
4747 y = add_noise (y , 10e-2 , SEED )
@@ -52,7 +52,7 @@ def f(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
5252@pytest .fixture
5353def case3 ():
5454 # m=3, q=2
55- def f (beta : np .ndarray , x : np .ndarray ) -> np .ndarray :
55+ def f (x : np .ndarray , beta : np .ndarray ) -> np .ndarray :
5656 y = np .zeros ((2 , x .shape [- 1 ]))
5757 y [0 , :] = (beta [0 ] * x [0 , :])** 3 + x [1 , :]** beta [1 ] + np .exp (x [2 , :]/ 2 )
5858 y [1 , :] = (beta [2 ] * x [0 , :])** 2 + x [1 , :]** beta [1 ]
@@ -61,7 +61,7 @@ def f(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
6161 beta_star = np .array ([1. , 2. , 3. ])
6262 x1 = np .linspace (- 1. , 1. , 31 )
6363 x = np .vstack ((x1 , np .exp (x1 ), x1 ** 2 ))
64- y = f (beta_star , x )
64+ y = f (x , beta_star )
6565
6666 x = add_noise (x , 5e-2 , SEED )
6767 y = add_noise (y , 10e-2 , SEED )
@@ -460,16 +460,16 @@ def test_jacobians():
460460 beta0 = np .array ([2. , 0.5 ])
461461 bounds = (np .array ([0. , 0. ]), np .array ([10. , 0.9 ]))
462462
463- def f (beta : np .ndarray , x : np .ndarray ) -> np .ndarray :
463+ def f (x : np .ndarray , beta : np .ndarray ) -> np .ndarray :
464464 return beta [0 ] * np .exp (beta [1 ]* x )
465465
466- def jac_beta (beta : np .ndarray , x : np .ndarray ) -> np .ndarray :
466+ def jac_beta (x : np .ndarray , beta : np .ndarray ) -> np .ndarray :
467467 jac = np .zeros ((beta .size , x .size ))
468468 jac [0 , :] = np .exp (beta [1 ]* x )
469469 jac [1 , :] = beta [0 ]* x * np .exp (beta [1 ]* x )
470470 return jac
471471
472- def jac_x (beta : np .ndarray , x : np .ndarray ) -> np .ndarray :
472+ def jac_x (x : np .ndarray , beta : np .ndarray ) -> np .ndarray :
473473 return beta [0 ] * beta [1 ] * np .exp (beta [1 ]* x )
474474
475475 beta_ref = np .array ([1.63337602 , 0.9 ])
@@ -539,7 +539,7 @@ def test_implicit_model():
539539 xdata = np .array (x ).T
540540 ydata = np .full (xdata .shape [- 1 ], 0.0 )
541541
542- def f (beta : np .ndarray , x : np .ndarray ) -> np .ndarray :
542+ def f (x : np .ndarray , beta : np .ndarray ) -> np .ndarray :
543543 v , h = x
544544 return beta [2 ]* (v - beta [0 ])** 2 + 2 * beta [3 ]* (v - beta [0 ])* (h - beta [1 ]) \
545545 + beta [4 ]* (h - beta [1 ])** 2 - 1
0 commit comments