@@ -46,12 +46,13 @@ def test_sklearnex_fit_on_gold_data(dataframe, queue, fit_intercept, macro_block
46
46
inclin .fit (X_df , y_df )
47
47
48
48
y_pred = inclin .predict (X_df )
49
+ np_y_pred = _as_numpy (y_pred )
49
50
50
- tol = 2e-6 if y_pred . dtype == np .float32 else 1e-7
51
+ tol = 2e-6 if dtype == np .float32 else 1e-7
51
52
assert_allclose (inclin .coef_ , [1 ], atol = tol )
52
53
if fit_intercept :
53
54
assert_allclose (inclin .intercept_ , [0 ], atol = tol )
54
- assert_allclose (_as_numpy ( y_pred ) , y , atol = tol )
55
+ assert_allclose (np_y_pred , y , atol = tol )
55
56
56
57
57
58
@pytest .mark .parametrize ("dataframe,queue" , get_dataframes_and_queues ())
@@ -84,14 +85,15 @@ def test_sklearnex_partial_fit_on_gold_data(
84
85
85
86
X_df = _convert_to_dataframe (X , sycl_queue = queue , target_df = dataframe )
86
87
y_pred = inclin .predict (X_df )
88
+ np_y_pred = _as_numpy (y_pred )
87
89
88
90
assert inclin .n_features_in_ == 1
89
- tol = 2e-6 if y_pred . dtype == np .float32 else 1e-7
91
+ tol = 2e-6 if dtype == np .float32 else 1e-7
90
92
assert_allclose (inclin .coef_ , [[1 ]], atol = tol )
91
93
if fit_intercept :
92
94
assert_allclose (inclin .intercept_ , 3 , atol = tol )
93
95
94
- assert_allclose (_as_numpy ( y_pred ) , y , atol = tol )
96
+ assert_allclose (np_y_pred , y , atol = tol )
95
97
96
98
97
99
@pytest .mark .parametrize ("dataframe,queue" , get_dataframes_and_queues ())
@@ -124,14 +126,15 @@ def test_sklearnex_partial_fit_multitarget_on_gold_data(
124
126
125
127
X_df = _convert_to_dataframe (X , sycl_queue = queue , target_df = dataframe )
126
128
y_pred = inclin .predict (X_df )
129
+ np_y_pred = _as_numpy (y_pred )
127
130
128
131
assert inclin .n_features_in_ == 2
129
- tol = 7e-6 if y_pred . dtype == np .float32 else 1e-7
132
+ tol = 7e-6 if dtype == np .float32 else 1e-7
130
133
assert_allclose (inclin .coef_ , [1.0 , 2.0 ], atol = tol )
131
134
if fit_intercept :
132
135
assert_allclose (inclin .intercept_ , 3.0 , atol = tol )
133
136
134
- assert_allclose (_as_numpy ( y_pred ) , y , atol = tol )
137
+ assert_allclose (np_y_pred , y , atol = tol )
135
138
136
139
137
140
@pytest .mark .parametrize ("dataframe,queue" , get_dataframes_and_queues ())
0 commit comments