File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -2873,3 +2873,37 @@ def inverse_transform(self, X):
2873
2873
X_tr [mask , idx ] = None
2874
2874
2875
2875
return X_tr
2876
+
2877
+ def get_feature_names (self , input_features = None ):
2878
+ """
2879
+ Return feature names for output features
2880
+
2881
+ Parameters
2882
+ ----------
2883
+ input_features : list of string, length n_features, optional
2884
+ String names for input features if available. By default,
2885
+ "x0", "x1", ... "xn_features" is used.
2886
+
2887
+ Returns
2888
+ -------
2889
+ output_feature_names : list of string, length n_output_features
2890
+
2891
+ """
2892
+ cats = self .categories_
2893
+ feature_names = []
2894
+ if input_features is None :
2895
+ input_features = ['x%d' % i for i in range (len (cats ))]
2896
+
2897
+ cats2 = []
2898
+ for i in range (len (cats )):
2899
+ temp = []
2900
+ for t in cats [i ]:
2901
+ temp .append (str (t ))
2902
+ cats2 .append (np .array (temp ))
2903
+
2904
+ for i in range (len (cats )):
2905
+ t = [input_features [i ] + '_' + f for f in cats2 [i ] ]
2906
+ feature_names .append (t )
2907
+
2908
+ feature_names = np .concatenate (feature_names )
2909
+ return feature_names
You can’t perform that action at this time.
0 commit comments