@@ -35,10 +35,15 @@ def test_interpolate_ev_linear_interp(self):
3535 x_test = np .array ([0. , 3. , 4. , 6. ])
3636 np .testing .assert_allclose (
3737 interpolate_ev (x_test , x_train , y_train ),
38+ np .array ([np .nan , 4. , 3. , np .nan ])
39+ )
40+ np .testing .assert_allclose (
41+ interpolate_ev (x_test , x_train , y_train , extrapolation = 'extrapolate_constant' ),
3842 np .array ([8. , 4. , 3. , np .nan ])
3943 )
4044 np .testing .assert_allclose (
41- interpolate_ev (x_test , x_train , y_train , y_asymptotic = 0 ),
45+ interpolate_ev (x_test , x_train , y_train ,
46+ extrapolation = 'extrapolate_constant' , y_asymptotic = 0 ),
4247 np .array ([8. , 4. , 3. , 0. ])
4348 )
4449
@@ -48,15 +53,17 @@ def test_interpolate_ev_threshold_parameters(self):
4853 y_train = np .array ([4. , 1. , 4. ])
4954 x_test = np .array ([- 1. , 3. , 4. ])
5055 np .testing .assert_allclose (
51- interpolate_ev (x_test , x_train , y_train ),
56+ interpolate_ev (x_test , x_train , y_train , extrapolation = 'extrapolate_constant' ),
5257 np .array ([4. , 1. , 2. ])
5358 )
5459 np .testing .assert_allclose (
55- interpolate_ev (x_test , x_train , y_train , x_threshold = 1. ),
60+ interpolate_ev (x_test , x_train , y_train , x_threshold = 1. ,
61+ extrapolation = 'extrapolate_constant' ),
5662 np .array ([1. , 1. , 2. ])
5763 )
5864 np .testing .assert_allclose (
59- interpolate_ev (x_test , x_train , y_train , y_threshold = 2. ),
65+ interpolate_ev (x_test , x_train , y_train , y_threshold = 2. ,
66+ extrapolation = 'extrapolate_constant' ),
6067 np .array ([4. , 4. , 4. ])
6168 )
6269
@@ -66,25 +73,27 @@ def test_interpolate_ev_scale_parameters(self):
6673 y_train = np .array ([1. , 3. ])
6774 x_test = np .array ([1e0 , 1e2 ])
6875 np .testing .assert_allclose (
69- interpolate_ev (x_test , x_train , y_train , logx = True , extrapolation = True ),
76+ interpolate_ev (x_test , x_train , y_train , logx = True , extrapolation = 'extrapolate' ),
7077 np .array ([0. , 2. ])
7178 )
7279 np .testing .assert_allclose (
73- interpolate_ev (x_test , x_train , y_train , logx = True ),
80+ interpolate_ev (x_test , x_train , y_train , logx = True ,
81+ extrapolation = 'extrapolate_constant' ),
7482 np .array ([1. , 2. ])
7583 )
7684 x_train = np .array ([1. , 3. ])
7785 y_train = np .array ([1e1 , 1e3 ])
7886 x_test = np .array ([0. , 2. ])
7987 np .testing .assert_allclose (
80- interpolate_ev (x_test , x_train , y_train , logy = True , extrapolation = True ),
88+ interpolate_ev (x_test , x_train , y_train , logy = True , extrapolation = 'extrapolate' ),
8189 np .array ([1e0 , 1e2 ])
8290 )
8391 x_train = np .array ([1e1 , 1e3 ])
8492 y_train = np .array ([1e1 , 1e5 ])
8593 x_test = np .array ([1e0 , 1e2 ])
8694 np .testing .assert_allclose (
87- interpolate_ev (x_test , x_train , y_train , logx = True , logy = True , extrapolation = True ),
95+ interpolate_ev (x_test , x_train , y_train , logx = True , logy = True ,
96+ extrapolation = 'extrapolate' ),
8897 np .array ([1e-1 , 1e3 ])
8998 )
9099
@@ -95,7 +104,7 @@ def test_interpolate_ev_degenerate_input(self):
95104 y_train = np .zeros (3 )
96105 np .testing .assert_allclose (
97106 interpolate_ev (x_test , x_train , y_train ),
98- np .array ([0. , 0. , 0. ])
107+ np .array ([np . nan , 0. , 0. ])
99108 )
100109
101110 def test_interpolate_ev_small_input (self ):
@@ -104,13 +113,18 @@ def test_interpolate_ev_small_input(self):
104113 y_train = np .array ([2. ])
105114 x_test = np .array ([0. , 1. , 2. ])
106115 np .testing .assert_allclose (
107- interpolate_ev (x_test , x_train , y_train ),
116+ interpolate_ev (x_test , x_train , y_train , extrapolation = 'extrapolate' ),
108117 np .array ([2. , 2. , np .nan ])
109118 )
110119 np .testing .assert_allclose (
111- interpolate_ev (x_test , x_train , y_train , y_asymptotic = 0 ),
120+ interpolate_ev (x_test , x_train , y_train , extrapolation = 'extrapolate' , y_asymptotic = 0 ),
112121 np .array ([2. , 2. , 0. ])
113122 )
123+ np .testing .assert_allclose (
124+ interpolate_ev (x_test , x_train , y_train ),
125+ np .full (3 , np .nan )
126+ )
127+
114128 x_train = np .array ([])
115129 y_train = np .array ([])
116130 x_test = np .array ([0. , 1. , 2. ])
@@ -119,7 +133,8 @@ def test_interpolate_ev_small_input(self):
119133 np .full (3 , np .nan )
120134 )
121135 np .testing .assert_allclose (
122- interpolate_ev (x_test , x_train , y_train , y_asymptotic = 0 ),
136+ interpolate_ev (x_test , x_train , y_train ,
137+ extrapolation = 'extrapolate_constant' , y_asymptotic = 0 ),
123138 np .zeros (3 )
124139 )
125140
0 commit comments