File tree 2 files changed +7
-7
lines changed
src/skore/sklearn/_estimator
tests/unit/sklearn/estimator/feature_importance
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -206,8 +206,12 @@ def coefficients(self) -> pd.DataFrame:
206
206
try :
207
207
intercept = np .atleast_2d (estimator .intercept_ )
208
208
except AttributeError :
209
+ # TransformedTargetRegressor() does not expose `intercept_`
210
+ intercept = np .atleast_2d (estimator .regressor_ .intercept_ )
211
+ # Uncomment when SGDOneClassSVM is fully supported by EstimatorReport
212
+ # except AttributeError:
209
213
# SGDOneClassSVM does not expose `intercept_`
210
- intercept = None
214
+ # intercept = None
211
215
212
216
try :
213
217
coef = np .atleast_2d (estimator .coef_ )
Original file line number Diff line number Diff line change @@ -224,19 +224,15 @@ def test_all_sklearn_estimators(
224
224
report = EstimatorReport (estimator )
225
225
result = report .feature_importance .coefficients ()
226
226
227
- rows = [
227
+ assert result .shape == (6 , 1 )
228
+ assert result .index .tolist () == [
228
229
"Intercept" ,
229
230
"Feature #0" ,
230
231
"Feature #1" ,
231
232
"Feature #2" ,
232
233
"Feature #3" ,
233
234
"Feature #4" ,
234
235
]
235
- if result .shape == (5 , 1 ): # for TransformedTargetRegressor()
236
- assert rows [1 :] == result .index .tolist ()
237
- else :
238
- assert result .shape == (6 , 1 )
239
- assert rows == result .index .tolist ()
240
236
241
237
assert result .columns .tolist () == ["Coefficient" ]
242
238
You can’t perform that action at this time.
0 commit comments