File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -742,6 +742,8 @@ def transform(self, y):
742742 A matrix such that `y_indicator[i, j] = 1` iff `classes_[j]` is in
743743 `y[i]`, and 0 otherwise.
744744 """
745+ check_is_fitted (self , 'classes_' )
746+
745747 class_to_index = dict (zip (self .classes_ , range (len (self .classes_ ))))
746748 yt = self ._transform (y , class_to_index )
747749
@@ -788,6 +790,8 @@ def inverse_transform(self, yt):
788790 The set of labels for each sample such that `y[i]` consists of
789791 `classes_[j]` for each `yt[i, j] == 1`.
790792 """
793+ check_is_fitted (self , 'classes_' )
794+
791795 if yt .shape [1 ] != len (self .classes_ ):
792796 raise ValueError ('Expected indicator for {0} classes, but got {1}'
793797 .format (len (self .classes_ ), yt .shape [1 ]))
You can’t perform that action at this time.
0 commit comments