elsereturn "categoricalcreating boolean conditions from features some of the algorithms require boolean input features or features with range { in order to be able to use these algorithms on datasets that allow for arbitrary domains of input variableswe construct boolean conditions from the attributes there are caseswhen the range only has two valueswe designate one to be the "truevalue when the values are all numericwe assume they are ordered (as opposed to just being some classes that happen to be labelled with numbersand construct boolean features for splits of the data that isthe feature is [indcut for some value cut we choose number of cut valuesup to maximum number of cutsgiven by max num cuts when the values are not all numericwe create an indicator function for each value an indicator function for value returns true when that value is given and false otherwise note that we can' create an indicator function for values that appear in the test set but not in the training set because we haven' seen the test set for the examples in the test set with value that doesn' appear in the training set for that featurethe indicator functions all return false there is also an option to only create boolean features from categorical input features learnproblem py -(continued def conditions(selfmax_num_cuts= categorical_only false)"""returns set of boolean conditions from the input features max_num_cuts is the maximum number of cute for numerical features categorical_only is true if only categorical features are made binary ""if (max_num_cutscategorical_onlyin self conditions_cachereturn self conditions_cache[(max_num_cutscategorical_only)conds [for ind,frange in enumerate(self domains)if ind !self target_index and len(frange)> if len(frange= two valuesthe feature is equality to one of them true_val list(frange)[ choose one as true def feat(ei=indtv=true_val)return [ ]==tv version june