def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of list of tuples) A list of summary sections. Each section is a list. Each item in a section list is a tuple of the form: ('<label>','<field>') section_titles: list A list of section titles. The order matches that of the 'sections' object. """ _features = _precomputed_field( _internal_utils.pretty_print_list(self.get('features'))) _exclude = _precomputed_field( _internal_utils.pretty_print_list(self.get('excluded_features'))) fields = [ ("Features", _features), ("Excluded features", _exclude), ("Output column name", 'output_column_name'), ("Max categories per column", 'max_categories'), ] section_titles = ['Model fields'] return ([fields], section_titles)
def _get_summary_struct(self): _features = _precomputed_field( _internal_utils.pretty_print_list(self.get('features'))) _exclude = _precomputed_field( _internal_utils.pretty_print_list(self.get('excluded_features'))) fields = [ ("Features", _features), ("Excluded features", _exclude), ] section_titles = ['Model fields'] return ([fields], section_titles)
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of list of tuples) A list of summary sections. Each section is a list. Each item in a section list is a tuple of the form: ('<feature>','<field>') section_titles: list A list of section titles. The order matches that of the 'sections' object. """ _reference_features = _precomputed_field( _internal_utils.pretty_print_list(self.get('reference_features'))) fields = [ ("reference_features", _reference_features), ("Column to impute", 'feature') ] section_titles = ['Model fields'] return ([fields], section_titles)
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of list of tuples) A list of summary sections. Each section is a list. Each item in a section list is a tuple of the form: ('<label>','<field>') section_titles: list A list of section titles. The order matches that of the 'sections' object. """ _features = _precomputed_field(_internal_utils.pretty_print_list(self.get("features"))) fields = [ ("Features", _features), ("Convert strings to lower case", "to_lower"), ("Delimiters", "delimiters"), ("Output column prefix", "output_column_prefix"), ] section_titles = ["Model fields"] return ([fields], section_titles)
def _get_summary_struct(self): _features = _precomputed_field(_internal_utils.pretty_print_list(self.get("features"))) fields = [ ("Features", _features), ("Minimimum Document Frequency", "min_document_frequency"), ("Maximimum Document Frequency", "max_document_frequency"), ("Output Column Name", "output_column_name"), ] section_titles = ["Model fields"] return ([fields], section_titles)
def _get_summary_struct(self): _features = _precomputed_field( _internal_utils.pretty_print_list(self.get('features'))) fields = [ ("Features", _features), ("Convert strings to lower case", 'to_lower'), ("Delimiters", "delimiters"), ("Output column prefix", 'output_column_prefix') ] section_titles = ['Model fields'] return ([fields], section_titles)
def _get_summary_struct(self): _features = _precomputed_field( _internal_utils.pretty_print_list(self.get('features'))) fields = [ ("Features", _features), ("query", 'query'), ("k1", 'k1'), ("b", 'b'), ("Minimimum Document Frequency", 'min_document_frequency'), ("Maximimum Document Frequency", 'max_document_frequency'), ("Output Column Name", 'output_column_name') ] section_titles = ['Model fields'] return ([fields], section_titles)
def _get_summary_struct(self): _features = _precomputed_field( _internal_utils.pretty_print_list(self.get('features'))) fields = [ ("NGram length", 'n'), ("NGram type (word or character)", 'ngram_type'), ("Convert strings to lower case", 'to_lower'), ("Ignore punctuation in character ngram", 'ignore_punct'), ("Ignore space in character ngram", 'ignore_space'), ("Delimiters", "delimiters"), ("Features", _features), ("Output column prefix", 'output_column_prefix') ] section_titles = ['Model fields'] return ([fields], section_titles)
def _compact_class_repr(obj): """ A compact version of __repr__ for each of the steps. """ dict_str_list = [] post_repr_string = "" # If features are present, then shorten it. fields = _inspect.getargspec(obj.__init__.im_func).args fields = fields[1:] # remove self if 'features' in fields: fields.remove('features') features = obj.get("features") if features != None: post_repr_string = ' on %s feature(s)' % len(features) if 'excluded_features' in fields: fields.remove('excluded_features') # GLC transformers. if issubclass(obj.__class__, _Transformer): for attr in fields: dict_str_list.append("%s=%s" % (attr, obj.get(attr).__repr__())) # Chains elif obj.__class__ == TransformerChain: _step_classes = map(lambda x: x.__class__.__name__, obj.get('steps')) _steps = _internal_utils.pretty_print_list( _step_classes, 'steps', False) dict_str_list.append(_steps) # For user defined transformers. else: for attr in fields: dict_str_list.append("%s=%s" % (attr, obj.__dict__[attr])) return "%s(%s)%s" % (obj.__class__.__name__, ", ".join(dict_str_list), post_repr_string)