本文整理汇总了Python中shaolin.core.dashboard.Dashboard类的典型用法代码示例。如果您正苦于以下问题:Python Dashboard类的具体用法?Python Dashboard怎么用?Python Dashboard使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dashboard类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, default_params=None,
metrics=None,
target=None,
**kwargs):
if default_params is None:
params = self.default_graph_params()
else:
params = default_params
if metrics is None:
metrics = self.default_node_metrics()
if target is None:
dict_target_attrs = self.default_target_attributes()
else:
dict_target_attrs = target
options = {'Mst':'mst',
'Pmfg':'pmfg',
'Full Matrix':'full'}
dash = ['c$N=graph_params',['###Graph params$N=gaphparams_title',
'@togs$d=Graph type&o='+str(options)+'&val='+str(params['graph_type']),
['r$N=gparams_row',['@[0.,50e10,1,'+str(params['threshold'])+']$N=threshold&d=Abs val threshold',
'@False$N=inverted&d=Invert distance'
]
],
'@selmul$d=Metrics&o='+str(metrics),
'@dd$N=target_attr&d=Target attribute&o='+str(dict_target_attrs)+'&val='+str(params['target_attr'])
]
]
Dashboard.__init__(self, dash, **kwargs)
self.metrics.value = tuple(metrics)
示例2: __init__
def __init__(self, hex=False, **kwargs):
self._hex = hex
colorcet = Colorcet(name='colorcet')
colorbrewer = ColorBrewerPalette(name='colorbrewer')
diverging = DivergingPalette(name='diverging')
sequential = SequentialPalette(name='sequential')
cubehelix = CubeHelixPalette(name='cubehelix')
sns_palette = SeabornPalette(name='sns_palette')
button_labels = ['Diverging', 'Colorbrewer', 'Sequential',
'Cubehelix', 'Seaborn']
children=[colorcet,diverging, colorbrewer, sequential,
cubehelix, sns_palette]
self._name_trans = dict(zip(range(len(button_labels)),[c.name for c in children]))
dash= ['t$N=master_palette_tabs&t=Colorcet,Diverging, Colorbrewer, Sequential,Cubehelix, Seaborn',
children]
Dashboard.__init__(self, dash,**kwargs)
self.pal = self.diverging.pal
self.cmap = self.diverging.cmap
self.observe(self.update_masterpalette)
self.update_masterpalette()
selected = getattr(self, self.tab_selected)
selected.as_cmap.value = True
示例3: __init__
def __init__(self, panel4D,description='Panel', mode='interactive', **kwargs):
self.panel4D = panel4D
self.output = None
if description == '':
desc_title = '##'+description+'$N=pslicer_text&v=0'
else:
desc_title = '##'+description+'$N=pslicer_text'
labels_slicer = ArraySlicer(panel4D.labels.values, name='labels_slicer', description='labels')
items_slicer = ArraySlicer(panel4D.items.values, name='items_slicer', description='items')
dash =['c$N=p4d_slicer',
[
desc_title,
['r$N=p4d_slicer_row',
[labels_slicer,
items_slicer,
ArraySlicer(panel4D.major_axis.values, name='major_axis_slicer', description='major_axis'),
ArraySlicer(panel4D.minor_axis.values, name='minor_axis_slicer', description='minor_axis')
]
]
]
]
Dashboard.__init__(self, dash, mode=mode, **kwargs)
self.observe(self.update)
self.update()
示例4: __init__
def __init__(self,
name='dash',
box='5c',
interact=None,
mode=None,
func=None,
dash=None,
group_n=3,
**kwargs):
self._group_n = group_n
self.__dic_mode = mode
self.__interact = interact
if self.__interact and mode is None:
self.__dic_mode = 'interactive'
if not func is None:
a = inspect.getargspec(func)
c_kwargs = dict(zip(a.args[-len(a.defaults):],a.defaults))
c_kwargs.update(kwargs)
else:
c_kwargs = kwargs
children = self.get_children_widgets(c_kwargs)
self.name = name
dash = dash or self.process_children_layout(box,children)#dash or [box+'$n='+name,children]
#print(dash)
Dashboard.__init__(self,dash,name=name,mode=mode)
self._func = func
self.observe(self.fun)
示例5: __init__
def __init__(self,
data,
max=None,
min=None,
step=None,
low=None,
high=None,
description='plot_data',
map_data = True,
default_color='blue',
**kwargs
):
self._data = data
self._description = description
slicer = self._get_data_slicer(description=description)
scaler = DataFrameScaler(slicer.output, max=max, min=min, step=step, low=low, high=high, name='data_scaler')
self.output = pd.DataFrame(index=scaler.output.index, columns=[description])
cmap = ColormapPicker(name='cm_picker', mode='interactive')
dash = ['r$N=main_row',
[
slicer,
['c$N=aply_col',[scaler,
['r$N=apply_row',['Map Data$N=map_text','@'+str(map_data)+'$N=map_chk','[['+str(map_data)+']]$N=map_valid']]
]],
['c$N=color_col',[ cmap,
'@cpicker$N=default_color&d=Default color&val='+default_color]]
]
]
Dashboard.__init__(self, dash, **kwargs)
self.link('map_chk','map_valid')
self.map_chk.target.layout.width = "100%"
self.map_valid.target.readout = 'Mapping disabled'
self.observe(self.update)
self.update()
示例6: __init__
def __init__(self,
showticklabels=True,
nticks=6,
ticksuffix="",
showticksuffix='none',
tickprefix='',
showtickprefix='none',
tickformat='',
tickmode='auto',
ticks='outside',
ticklen=5,
tickvals=[],
ticktext=[],
tickfont={'family':'Verdana'},
tickwidth=1,
tick0=0,
tickangle=-1,
dtick=1,
tickcolor='#444',
title='Ticks',
**kwargs):
show_mode = ['all','first','all','none']
show_row = ['r$n=row_show',[
['c$N=subcol_1',['@'+str(showticklabels)+'$d=Showticklabels']],
['c$N=subcol_2',['@dd$d=Show suffix&n=showticksuffix&o='+str(show_mode)+'&val='+str(showticksuffix),
'@text$d=suffix&n=ticksuffix&val='+str(showticksuffix)]],
['c$N=subcol_3',['@dd$d=Show prefix&n=showtickprefix&o='+str(show_mode)+'&val='+str(showtickprefix),
'@text$d=prefix&n=tickprefix&val='+str(showtickprefix)]]
]]
tickmode_opts = ['auto','linear','array']
mode_row = ['r$N=mode_row',[['c$N=mscol_1',['@float_text$d=tick0&val='+str(tick0),
'@(0,500,1,'+str(nticks)+')$d=nticks']],
['c$N=mscol_2',['@dd$d=tickmode&o='+str(tickmode_opts)+'&val='+str(tickmode),
'(0.,500.,0.25,'+str(dtick)+')$d=dtick']],
]
]
font_m = FontManager(name='tickfont',title='tickfont',mode='interactive')
format_row = ['r$N=format_row',[font_m,
['c$N=fcol_1',['@dd$d=ticks&o=["outside","inside",""]',
'@cp$d=tickcolor',
'@(0,25,1,'+str(ticklen)+')$d=ticklen',
'@(0,25,1,'+str(tickwidth)+')$d=tickwidth',
'@(-1,360,1,'+str(tickangle)+')$d=tickangle',
'@text$d=tickformat&val=""',
]]
]
]
toggle_row = ['r$N=toggle_rowb',['[True]$d=show&n=show_togb&mode=passive','[True]$d=mode&n=mode_tog&mode=passive','[True]$d=format&n=format_togb&mode=passive']]
dash = ['c$n=ticks_col_b',[['##'+title+'$N=ticks_title'],
['r$N=in_row',[['c$N=widget_row_a',[show_row, mode_row]],format_row]],
toggle_row
]
]
Dashboard.__init__(self, dash, **kwargs)
for slider in ['dtick','ticklen','tickwidth','tickangle']:
getattr(self,slider).target.continuous_update = False
示例7: __init__
def __init__(self, data, mode='interactive', **kwargs):
self._data = data
dash = ['c$N=tooltip',
['###Tolltip$N=title',
'@selmul$n=tooltip_cols&d=Tooltip info&o='+str(tuple(data.columns.values))
]
]
self.output = data.copy()
Dashboard.__init__(self, dash, mode=mode, **kwargs)
self.tooltip_cols.value = tuple(data.columns.values)
self.observe(self.update)
self.update()
示例8: __init__
def __init__(self,description='Cmap', **kwargs):
dash = ['c$N=cmap_picker',
[
['r$N=display_col',['btn$N=cmap_btn&d='+description, 'HTML$N=mini_display']],
['c$N=palette_col', [MasterPalette(name='master_palette',mode='interactive'),'btn$d=Close&N=close_btn'] ]
]
]
Dashboard.__init__(self, dash, **kwargs)
self.mini_display.target.layout.width = "20em"
self.mini_display.target.layout.height = "2em"
self.palette_col.visible = False
self.cmap = self.master_palette.cmap
self.pal = self.master_palette.pal
self.cmap_btn.observe(self._on_cmap_click)
self.close_btn.observe(self._on_close_click)
self._on_close_click()
示例9: __init__
def __init__(self,
data,
funcs=None,
min=0,
max=100,
step=None,
low=None,
high=None,
**kwargs):
if funcs is None:
self.funcs = {'raw':lambda x: x,
'zscore': lambda x: (x-np.mean(x))/np.std(x),
'log': np.log,
'rank':lambda x: pd.DataFrame(x).rank().values.flatten(),
'inv': lambda x: -x,
'cut':lambda x: pd.cut(x,[-1001, 0.1,0.3, 0.6, 0.8, 1.0,1.5, 3.0, 6.0, 12, 1001],labels=False)
}
else:
self.funcs = funcs
self._df = data.apply(self.categorical_to_num)
if min is None:
min = self._df.min().values[0]
if max is None:
max = self._df.max().values[0]
if step is None:
step = (max-min)/100.
if low is None:
low = min
if high is None:
high = max
self.output = None
dash = ['c$N=df_scaler',
['@('+str(min)+', '+str(max)+', '+str(step)+', ('+str(low)+', '+str(high)+'))$N=scale_slider&d=Scale',
['r$N=main_row',['@dd$d=Apply&N=dd_sel&val=raw&o='+str(list(self.funcs.keys())),'@True$N=scale_chk&d=Scale']]
]
]
Dashboard.__init__(self, dash, mode='interactive', **kwargs)
self.dd_sel.target.layout.width = "100%"
self.scale_chk.widget.layout.padding = "0.25em"
self.observe(self.update)
self.update()