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. """ section_titles = ['Schema', 'Settings'] vocab_length = len(self.vocabulary) verbose = self.verbose == 1 sections = [[('Vocabulary Size', _precomputed_field(vocab_length))], [('Number of Topics', 'num_topics'), ('alpha', 'alpha'), ('beta', 'beta'), ('Iterations', 'num_iterations'), ('Training time', 'training_time'), ('Verbose', _precomputed_field(verbose))]] return (sections, 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'))) _exclude = _precomputed_field( _internal_utils.pretty_print_list(self.get('excluded_features'))) _stopwords = _precomputed_field( _internal_utils.pretty_print_list(self.get('stopwords'))) fields = [("Features", _features), ("Excluded features", _exclude), ("Output column name", 'output_column_prefix'), ("Word count threshold", 'threshold'), ("Manually specified stopwords", _stopwords), ("Whether to convert to lowercase", "to_lower"), ("Delimiters", "delimiters")] 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), ("Separator", "separator"), ("None Tag", "none_tag"), ("Output Column Prefix", 'output_column_prefix') ] 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. """ g = self.graph section_titles = ["Graph"] graph_summary = [(k, _precomputed_field(v)) for k, v in six.iteritems(g.summary())] sections = [graph_summary] # collect other sections results = [(k, _precomputed_field(v)) for k, v in six.iteritems(self._result_fields())] methods = [(k, _precomputed_field(v)) for k, v in six.iteritems(self._method_fields())] settings = [(k, v) for k, v in six.iteritems(self._setting_fields())] metrics = [(k, v) for k, v in six.iteritems(self._metric_fields())] optional_sections = [ ("Results", results), ("Settings", settings), ("Metrics", metrics), ("Methods", methods), ] # if section is not empty, append to summary structure for (title, section) in optional_sections: if len(section) > 0: section_titles.append(title) sections.append(section) return (sections, section_titles)
def __repr__(steps): for name, tr in self._transformers: model_fields.append( (name, _precomputed_field(self._compact_class_repr(tr)))) return _toolkit_repr_print(steps, [model_fields], width=8, section_titles=["Steps"])
def _get_summary_struct(self): model_fields = [] for attr in self.__dict__: if not attr.startswith("_"): model_fields.append((attr, _precomputed_field(getattr(self, attr)))) return ([model_fields], ["Attributes"])
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): model_fields = [] for attr in dir(self): if not attr.startswith('_'): model_fields.append( (attr, _precomputed_field(getattr(self, attr)))) return ([model_fields], ['Attributes'])
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), ("Minimimum Document Frequency", 'min_document_frequency'), ("Maximimum Document Frequency", 'max_document_frequency'), ("Output Column Prefix", 'output_column_prefix')] section_titles = ['Model fields'] return ([fields], section_titles)
def _get_struct_summary(self): model_fields = [] for name, tr in self._transformers: model_fields.append( (name, _precomputed_field(self._compact_class_repr(tr)))) sections = [model_fields] section_titles = ["Steps"] return (sections, 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 __repr__(self): descriptions = [(k, _precomputed_field(v)) for k, v in six.iteritems(self._describe_fields())] (sections, section_titles) = self._get_summary_struct() non_empty_sections = [s for s in sections if len(s) > 0] non_empty_section_titles = [section_titles[i] for i in range(len(sections)) if len(sections[i]) > 0] non_empty_section_titles.append('Queryable Fields') non_empty_sections.append(descriptions) return _toolkit_repr_print(self, non_empty_sections, non_empty_section_titles, width=40)
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"), ("Minimum Document Frequency", "min_document_frequency"), ("Maximum Document Frequency", "max_document_frequency"), ("Output Column Name", "output_column_name"), ] 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. """ sections = [] fields = [] _features = _precomputed_field( _internal_utils.pretty_print_list(self.features)) _exclude = _precomputed_field( _internal_utils.pretty_print_list(self.excluded_features)) header_fields = [("Features", "features"), ("Excluded Features", "excluded_features")] sections.append("Model Fields") fields.append(header_fields) if self.user_column_interpretations: sections.append("User Specified Interpretations") fields.append( list(sorted(self._get("user_column_interpretations").items()))) column_interpretations = self._get("column_interpretations") features = self._get("features") if self._get("fitted") and features is not None: n_rows = len(features) transform_info = [None] * n_rows for i, f in enumerate(features): interpretation = column_interpretations[f] input_type = self.input_types[f] description, output_type = _get_interpretation_description_and_output_type( interpretation, input_type) transform_info[i] = (f, input_type.__name__, interpretation, description, output_type.__name__) transform_table = _SFrame() transform_table["Column"] = [t[0] for t in transform_info] transform_table["Type"] = [t[1] for t in transform_info] transform_table["Interpretation"] = [t[2] for t in transform_info] transform_table["Transforms"] = [t[3] for t in transform_info] transform_table["Output Type"] = [t[4] for t in transform_info] fields[-1].append(transform_table) return fields, sections