Coverage for mlinsights/mlmodel/sklearn_transform_inv.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2023-02-28 08:46 +0100

1""" 

2@file 

3@brief Implements a base class which defines a pair of transforms 

4applied around a predictor to modify the target as well. 

5""" 

6from sklearn.base import TransformerMixin, BaseEstimator 

7 

8 

9class BaseReciprocalTransformer(BaseEstimator, TransformerMixin): 

10 """ 

11 Base for transform which transforms the features 

12 and the targets at the same time. It must also 

13 return another transform which transforms the target 

14 back to what it was. 

15 """ 

16 

17 def __init__(self): 

18 BaseEstimator.__init__(self) 

19 TransformerMixin.__init__(self) 

20 

21 def get_fct_inv(self): 

22 """ 

23 Returns a trained transform which reverse the target 

24 after a predictor. 

25 """ 

26 raise NotImplementedError( 

27 "This must be overwritten.") # pragma: no cover 

28 

29 def transform(self, X, y): 

30 """ 

31 Transforms *X* and *y*. 

32 Returns transformed *X* and *y*. 

33 """ 

34 raise NotImplementedError( 

35 "This must be overwritten.") # pragma: no cover