File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 66import numpy as np
77import sklearn .base
88from sklearn .base import BaseEstimator , TransformerMixin
9+ from sklearn .exceptions import NotFittedError
910from typing import Dict , List , Optional , Union
1011from scipy .sparse import csr_matrix
1112
@@ -315,7 +316,7 @@ def _check_transform_inputs(self, X):
315316 raise ValueError ('Columns to be encoded can not contain null' )
316317
317318 if self ._dim is None :
318- raise ValueError ('Must train encoder before it can be used to transform data.' )
319+ raise NotFittedError ('Must train encoder before it can be used to transform data.' )
319320
320321 # then make sure that it is the right size
321322 if X .shape [1 ] != self ._dim :
@@ -356,7 +357,7 @@ def get_feature_names(self) -> List[str]:
356357
357358 """
358359 if not isinstance (self .feature_names , list ):
359- raise ValueError ("Estimator has to be fitted to return feature names." )
360+ raise NotFittedError ("Estimator has to be fitted to return feature names." )
360361 else :
361362 return self .feature_names
362363
You can’t perform that action at this time.
0 commit comments