@@ -81,16 +81,18 @@ def test_mean_imputation(self):
8181 [4 , 3.5 , 3 ]]))
8282
8383 def test_median_imputation (self ):
84- data = np .array ([[1.0 , np .nan , 3 ],
85- [np .nan , 8 , 9 ],
86- [4.0 , 5 , np .nan ],
87- [np .nan , 2 , 3 ],
88- [7.0 , np .nan , 9 ],
89- [4.0 , np .nan , np .nan ]])
84+ data = np .array ([[1.0 , np .nan , 7 ],
85+ [np .nan , 9 , 10 ],
86+ [10.0 , 7 , 7 ],
87+ [9.0 , np .nan , 11 ],
88+ [9.0 , 9 , np .nan ],
89+ [np .nan , 5 , 6 ],
90+ [12.0 , np .nan , 8 ],
91+ [9.0 , np .nan , np .nan ]])
9092 numerical_columns = [0 , 1 , 2 ]
9193 categorical_columns = []
92- train_indices = np .array ([0 , 2 , 3 ])
93- test_indices = np .array ([1 , 4 , 5 ])
94+ train_indices = np .array ([0 , 2 , 3 , 4 , 7 ])
95+ test_indices = np .array ([1 , 5 , 6 ])
9496 dataset_properties = {
9597 'categorical_columns' : categorical_columns ,
9698 'numerical_columns' : numerical_columns ,
@@ -118,21 +120,23 @@ def test_median_imputation(self):
118120 column_transformer = column_transformer .fit (X ['X_train' ])
119121 transformed = column_transformer .transform (data [test_indices ])
120122
121- assert_array_equal (transformed , np .array ([[2.5 , 8 , 9 ],
122- [7 , 3. 5 , 9 ],
123- [4 , 3.5 , 3 ]]))
123+ assert_array_equal (transformed , np .array ([[9 , 9 , 10 ],
124+ [9 , 5 , 6 ],
125+ [12 , 8 , 8 ]]))
124126
125127 def test_frequent_imputation (self ):
126- data = np .array ([[1.0 , np .nan , 3 ],
127- [np .nan , 8 , 9 ],
128- [4.0 , 5 , np .nan ],
129- [np .nan , 2 , 3 ],
130- [7.0 , np .nan , 9 ],
131- [4.0 , np .nan , np .nan ]])
128+ data = np .array ([[1.0 , np .nan , 7 ],
129+ [np .nan , 9 , 10 ],
130+ [10.0 , 7 , 7 ],
131+ [9.0 , np .nan , 11 ],
132+ [9.0 , 9 , np .nan ],
133+ [np .nan , 5 , 6 ],
134+ [12.0 , np .nan , 8 ],
135+ [9.0 , np .nan , np .nan ]])
132136 numerical_columns = [0 , 1 , 2 ]
133137 categorical_columns = []
134- train_indices = np .array ([0 , 2 , 3 ])
135- test_indices = np .array ([1 , 4 , 5 ])
138+ train_indices = np .array ([0 , 2 , 4 , 5 , 7 ])
139+ test_indices = np .array ([1 , 3 , 6 ])
136140 dataset_properties = {
137141 'categorical_columns' : categorical_columns ,
138142 'numerical_columns' : numerical_columns ,
@@ -160,9 +164,9 @@ def test_frequent_imputation(self):
160164 column_transformer = column_transformer .fit (X ['X_train' ])
161165 transformed = column_transformer .transform (data [test_indices ])
162166
163- assert_array_equal (transformed , np .array ([[1 , 8 , 9 ],
164- [7 , 2 , 9 ],
165- [4 , 2 , 3 ]]))
167+ assert_array_equal (transformed , np .array ([[9 , 9 , 10 ],
168+ [9 , 5 , 11 ],
169+ [12 , 5 , 8 ]]))
166170
167171 def test_constant_imputation (self ):
168172 data = np .array ([[1.0 , np .nan , 3 ],
0 commit comments