@@ -18,39 +18,39 @@ def compare_with_NaN(x, y):
18
18
19
19
20
20
# tests
21
- def test_get_grid_points_num_grid_points ():
21
+ def test__get_grid_points_num_grid_points ():
22
22
x = pd .Series (np .array ([0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ]))
23
23
expected_grid_points = np .array ([0 , 1 , 3 , 5 , 7 ])
24
24
25
- assert (expected_grid_points == ice .get_grid_points (x , 5 )).all ()
25
+ assert (expected_grid_points == ice ._get_grid_points (x , 5 )).all ()
26
26
27
27
28
- def test_get_grid_points_num_grid_points_too_many ():
28
+ def test__get_grid_points_num_grid_points_too_many ():
29
29
x = pd .Series (np .array ([0 , 0 , 1 ]))
30
30
expected_grid_points = np .array ([0 , 0.5 , 1 ])
31
31
32
- assert (expected_grid_points == ice .get_grid_points (x , 5 )).all ()
32
+ assert (expected_grid_points == ice ._get_grid_points (x , 5 )).all ()
33
33
34
34
35
35
@given (st .lists (st .floats ()))
36
- def test_get_grid_points_num_grid_points_None (l ):
36
+ def test__get_grid_points_num_grid_points_None (l ):
37
37
x = pd .Series (l )
38
38
39
- assert compare_with_NaN (x .unique (), ice .get_grid_points (x , None )).all ()
39
+ assert compare_with_NaN (x .unique (), ice ._get_grid_points (x , None )).all ()
40
40
41
41
42
42
@given ((st .tuples (st .integers (min_value = 2 , max_value = 10 ))
43
43
.flatmap (lambda size : arrays (np .float64 , size ))),
44
44
(st .tuples (st .integers (min_value = 2 , max_value = 10 ))
45
45
.flatmap (lambda size : arrays (np .float64 , size ))))
46
- def test_get_point_x_ilocs (grid , data ):
46
+ def test__get_point_x_ilocs (grid , data ):
47
47
assume (np .isfinite (grid ).all ())
48
48
assume (np .isfinite (data ).all ())
49
49
50
50
grid_index = pd .Float64Index (grid , name = 'x' )
51
51
data_index = pd .Float64Index (data , name = 'data_x' )
52
52
53
- point_x_ilocs = ice .get_point_x_ilocs (grid_index , data_index )
53
+ point_x_ilocs = ice ._get_point_x_ilocs (grid_index , data_index )
54
54
55
55
diffs = np .subtract .outer (grid , data )
56
56
@@ -118,14 +118,14 @@ def test_pdp(args):
118
118
assert compare_with_NaN (pdp , pdp_expected ).all ()
119
119
120
120
121
- def test_to_ice_data ():
121
+ def test__to_ice_data ():
122
122
X = np .array ([[1 , 2 , 3 ],
123
123
[4 , 5 , 6 ],
124
124
[7 , 8 , 9 ]])
125
125
data = pd .DataFrame (X , columns = ['x1' , 'x2' , 'x3' ])
126
126
x_s = np .array ([10 , 11 ])
127
127
128
- ice_data , orig_column = ice .to_ice_data (data , 'x3' , x_s )
128
+ ice_data , orig_column = ice ._to_ice_data (data , 'x3' , x_s )
129
129
ice_data_expected = pd .DataFrame (np .array ([[1 , 2 , 10 ],
130
130
[1 , 2 , 11 ],
131
131
[4 , 5 , 10 ],
@@ -144,12 +144,12 @@ def test_to_ice_data():
144
144
.flatmap (lambda size : arrays (np .float64 , (1 ,) + size ))),
145
145
(st .tuples (st .integers (min_value = 1 , max_value = 10 ))
146
146
.flatmap (lambda shape : arrays (np .float64 , shape ))))
147
- def test_to_ice_data_one_sample (X , x_s ):
147
+ def test__to_ice_data_one_sample (X , x_s ):
148
148
n_cols = X .shape [1 ]
149
149
columns = ['x{}' .format (i ) for i in range (n_cols )]
150
150
data = pd .DataFrame (X , columns = list (columns ))
151
151
152
- ice_data , orig_column = ice .to_ice_data (data , 'x1' , x_s )
152
+ ice_data , orig_column = ice ._to_ice_data (data , 'x1' , x_s )
153
153
154
154
ice_data_expected_values = np .repeat (X , x_s .size , axis = 0 )
155
155
ice_data_expected_values [:, 1 ] = x_s
@@ -165,14 +165,14 @@ def test_to_ice_data_one_sample(X, x_s):
165
165
st .integers (min_value = 2 , max_value = 10 ))
166
166
.flatmap (lambda shape : arrays (np .float64 , shape ))),
167
167
st .floats ())
168
- def test_to_ice_data_one_test_point (l , x_s ):
168
+ def test__to_ice_data_one_test_point (l , x_s ):
169
169
X = np .array (l )
170
170
n_cols = X .shape [1 ]
171
171
columns = ['x{}' .format (i ) for i in range (n_cols )]
172
172
data = pd .DataFrame (X , columns = columns )
173
173
x_s = np .array (x_s )
174
174
175
- ice_data , orig_column = ice .to_ice_data (data , 'x0' , x_s )
175
+ ice_data , orig_column = ice ._to_ice_data (data , 'x0' , x_s )
176
176
177
177
ice_data_expected_values = X .copy ()
178
178
ice_data_expected_values [:, 0 ] = x_s
0 commit comments