2727from Orange .preprocess import Continuize , ProjectPCA , RemoveNaNRows , \
2828 ProjectCUR , Scale as _Scale , Randomize as _Randomize , RemoveSparse
2929from Orange .widgets import widget , gui
30+ from Orange .widgets .utils .localization import pl
3031from Orange .widgets .settings import Setting
3132from Orange .widgets .utils .overlay import OverlayWidget
3233from Orange .widgets .utils .sql import check_sql_input
@@ -253,9 +254,9 @@ def createinstance(params):
253254 def __repr__ (self ):
254255 return self .Continuizers [self .__treatment ]
255256
256- class RemoveSparseEditor (BaseEditor ):
257257
258- options = ["missing" , "zeros" ]
258+ class RemoveSparseEditor (BaseEditor ):
259+ options = ["missing values" , "zeros" ]
259260
260261 def __init__ (self , parent = None , ** kwargs ):
261262 super ().__init__ (parent , ** kwargs )
@@ -266,11 +267,9 @@ def __init__(self, parent=None, **kwargs):
266267 self .setLayout (QVBoxLayout ())
267268
268269 self .layout ().addWidget (QLabel ("Remove features with too many" ))
269- options = ["missing values" ,
270- "zeros" ]
271270 self .filter_buttons = QButtonGroup (exclusive = True )
272271 self .filter_buttons .buttonClicked .connect (self .filterByClicked )
273- for idx , option , in enumerate (options ):
272+ for idx , option , in enumerate (self . options ):
274273 btn = QRadioButton (self , text = option , checked = idx == 0 )
275274 self .filter_buttons .addButton (btn , id = idx )
276275 self .layout ().addWidget (btn )
@@ -354,6 +353,15 @@ def createinstance(params):
354353 threshold = params .pop ('percThresh' , 5 ) / 100
355354 return RemoveSparse (threshold , filter0 )
356355
356+ def __repr__ (self ):
357+ desc = f"remove features with too many { self .options [self .filter0 ]} , threshold: "
358+ if self .useFixedThreshold :
359+ desc += f"{ self .fixedThresh } { pl (self .fixedThresh , 'instance' )} "
360+ else :
361+ desc += f"{ self .percThresh } %"
362+ return desc
363+
364+
357365class ImputeEditor (BaseEditor ):
358366 (NoImputation , Constant , Average ,
359367 Model , Random , DropRows , DropColumns ) = 0 , 1 , 2 , 3 , 4 , 5 , 6
@@ -727,6 +735,12 @@ def createinstance(params):
727735 # further implementations
728736 raise NotImplementedError
729737
738+ def __repr__ (self ):
739+ if self .__strategy == self .Fixed :
740+ return f"select { self .__k } { pl (self .__k ,'feature' )} "
741+ else :
742+ return f"select { self .__p } % features"
743+
730744
731745def index_to_enum (enum , i ):
732746 """Enums, by default, are not int-comparable, so use an ad-hoc mapping of
0 commit comments