def html(self): elements = [Title('dashboard')] if self.features: elements += [ Annotation('features'), Pool([ Raw(i.html_collapsible()) for i in self.features.values() ]) ] else: elements += [ Annotation('features'), Field("You've got no features so far.") ] if self.helpers: elements += [ Annotation('helpers'), Pool( [Raw(i.html_collapsible()) for i in self.helpers.values()]) ] else: elements += [ Annotation('helpers'), Field("You've got no helpers so far.") ] # TODO: add 5 best/recent experiments from lb elements += [CSS(cfg._theme.css), CSS(cfg._highlighter.css)] return Column(elements).html
def html(self): tmp = [Progress(self.value, self.total, **self.progress_formatting)] if self.output is not None: tmp += [Output(self.output)] return Row([ InnerColumn(tmp), Field(format_value(self.took, time=True), **self.indicator_formatting), Field(format_value(self.eta, time=True), **self.indicator_formatting) ]).html
def html(self): head_cells = [Field(self.col_names[0], **self.head_style(self.col_widths[0]))] for i in range(1, len(self.col_widths)): head_cells.append(Field(self.col_names[i], **self.head_style(self.col_widths[i]))) rows = [[Field(self.data[i][j], **self.cell_style(self.col_widths[j])) for j in range(len(self.data[0])) ] for i in range(len(self.data))] rows = [Raw(e.html_collapsible(ThumbnailField(self.concat(rows[i]), css_id=-1, first=False), border=True)) for i, e in enumerate(self.experiments)] res = Column([Title('leaderboard'), Field(self.concat(head_cells), bg=False, bold=False, style="padding-bottom: 0px; margin: 0px 2px 0px 2px;")] + rows) return res.html
def html(self): name_annotation = Annotation('feature', style="text-align: right; margin-bottom: 3px; margin-right: 5px;") mean_annotation = Annotation('mean', style="margin-left: 7px; margin-bottom: 3px;") hbar_annotation = Annotation('importance', style="margin-left: 5px; margin-bottom: 3px;") # names = [i['feature_constructor'].html_collapsible(name=i['name'], style='padding: 0px 5px; text-align: right;', bg=False, border=True) for i in self.features] names = [Field(i['name'], style='padding: 0px 5px; text-align: right; margin: 2px;', bg=False).html for i in self.features] means = [Field(format_value(i['mean']), style='padding: 0px 5px; max-height: 1.5em; margin: 2px;', bg=False).html for i in self.features] hbars = [Importance(self.to_px(i['mean']), self.to_px(i['min']), self.to_px(i['max']), self.zero_position).html for i in self.features] return AlignedColumns([ [name_annotation.html] + names, [mean_annotation.html] + means, [hbar_annotation.html] + hbars, ], title='feature importances').html
def html(self, annotations): ind_kw = dict( style='width: 4.5em; padding-top: 0px; padding-bottom: 0px;', bg=False, bold=True) return Row([ InnerColumn([Annotation('id')] * (annotations) + [Field(self.id, **ind_kw)]), InnerColumn([Annotation('progress')] * (annotations) + [ Progress(self.fold, self.n_folds, style='width: 400px; margin-top: 5px;') ]), InnerColumn([Annotation('took')] * (annotations) + [Field(format_value(self.took, True), **ind_kw)]), InnerColumn([Annotation('eta')] * (annotations) + [Field(format_value(self.eta, True), **ind_kw)]), ])
def html(self): ind_kw = dict(style='width: 4.5em; padding-top: 0px; padding-bottom: 0px;', bg=False, bold=True) return Column([ Title('computing importances'), Row([ InnerColumn([ Annotation('progress'), Progress(self.step, self.total, style='width: 500px; margin-top: 7px;'), Output(f'Computing {self.current_feature}') ]), InnerColumn([ Annotation('took'), Field(format_value(self.took, time=True), **ind_kw) ]), InnerColumn([ Annotation('eta'), Field(format_value(self.eta, time=True), **ind_kw) ]), ]) ]).html
def html(self): # thumbnails = [i.html_collapsable(**self.thumbnail_formatting) for i in self.active_features] thumbnails = [ Field(i, **self.thumbnail_formatting).html for i in self.active_feature_names ] blocks = self.progress_blocks return AlignedColumns( [[ Annotation('feature', ** self.thumbnail_annotation_formatting).html ] + thumbnails, [ Annotation('progress', ** self.progress_annotation_formatting).html ] + blocks], title='computing features').html
def html(self, active=False, annotations=False): ind_kw = dict( style='width: 4.5em; padding-top: 0px; padding-bottom: 0px;', bg=False, bold=True) indicators = Row([ InnerColumn([Annotation('progress')] * (annotations) + [ Progress(self.step, self.n_steps, style='width: 400px; margin-top: 5px;') ]), # calc(600px - 12rem - 150px) InnerColumn([Annotation('train')] * (annotations) + [ Field(format_value(self.current_train_score), **ind_kw, accent=False) ]), InnerColumn( [Annotation('valid')] * (annotations) + [Field(format_value(self.current_valid_score), **ind_kw)]), InnerColumn([Annotation(self.metric_name)] * (annotations) + [Field(format_value(self.metric_value), **ind_kw)]), InnerColumn([Annotation('took')] * (annotations) + [Field(format_value(self.took, True), **ind_kw)]), InnerColumn([Annotation('eta')] * (annotations) + [Field(format_value(self.eta, True), **ind_kw)]), ]) if active: lines = [] colors = [] if len(self.train_scores) >= 5: lines.append(self.train_scores) colors.append(cfg._theme.third) if len(self.valid_scores) >= 5: lines.append(self.valid_scores) colors.append(cfg._theme.accent) if len(lines) >= 1: lines = self.clip_outliers(lines) for i in range(len(lines)): steps = list(zip(*lines[i]))[0] scores = list(zip(*lines[i]))[1] lines[i] = Line(steps, scores, colors[i]) indicators.elements[0].elements.append( Field(Plot(lines, height=200, width=385).html, bg=False, style='padding-right: 0px; padding-left: 5px;')) return indicators.html else: return indicators.html else: return indicators.html
def parse_to_html(doc, title=None, signature=None): doc = parse(doc) elements = [Title(title or 'docs')] if signature: elements += [Annotation('signature'), Code(signature)] description = doc.short_description if doc.long_description: description += '\n\n' + doc.long_description elements += [Annotation('description'), Field(description, bg=False)] param_kw = dict( style="padding-bottom: 0px; padding-top: 0px; margin-bottom: 0px;") if doc.params: elements += [Annotation('params')] params = [] descriptions = [] for param in doc.params: params.append( Field(param.arg_name, bold=True, bg=False, accent=False, **param_kw).html) descriptions.append( Field(param.description, bold=True, bg=False, accent=True, **param_kw).html) container_kw = dict( style= "auto auto; padding-left: 0px; padding-right: 0px; justify-content: start;" ) elements += [ AlignedColumns([params, descriptions], bg=True, **container_kw) ] if doc.returns: elements += [Annotation('returns')] elements += [Field(f"{doc.returns.description}", bg=False)] if doc.raises: elements += [Annotation('raises')] for exception in doc.raises: elements += [ Field(f"{exception.type_name}: {exception.description}", bg=False) ] examples = [ i for i in doc.meta if isinstance(i, DocstringMeta) and i.args[0] == 'examples' ] if examples: elements += [Annotation('examples')] elements += [Code(examples[0].description)] return "<div class='kts'>" + Column(elements).html + "</div>"