Last active
May 24, 2020 06:04
-
-
Save pierrelouisbescond/510bc9388abb8e5e18f38872911f9ff8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
app = dash.Dash() | |
# The page structure will be: | |
# Features Importance Chart | |
# <H4> Feature #1 name | |
# Slider to update Feature #1 value | |
# <H4> Feature #2 name | |
# Slider to update Feature #2 value | |
# <H4> Feature #3 name | |
# Slider to update Feature #3 value | |
# <H2> Updated Prediction | |
# Callback fuction with Sliders values as inputs and Prediction as Output | |
# We apply basic HTML formatting to the layout | |
app.layout = html.Div(style={'textAlign': 'center', 'width': '800px', 'font-family': 'Verdana'}, | |
children=[ | |
# Title display | |
html.H1(children="Simulation Tool"), | |
# Dash Graph Component calls the fig_features_importance parameters | |
dcc.Graph(figure=fig_features_importance), | |
# We display the most important feature's name | |
html.H4(children=slider_1_label), | |
# The Dash Slider is built according to Feature #1 ranges | |
dcc.Slider( | |
id='X1_slider', | |
min=slider_1_min, | |
max=slider_1_max, | |
step=0.5, | |
value=slider_1_mean, | |
marks={i: '{} bars'.format(i) for i in range(slider_1_min, slider_1_max+1)} | |
), | |
# The same logic is applied to the following names / sliders | |
html.H4(children=slider_2_label), | |
dcc.Slider( | |
id='X2_slider', | |
min=slider_2_min, | |
max=slider_2_max, | |
step=0.5, | |
value=slider_2_mean, | |
marks={i: '{}°'.format(i) for i in range(slider_2_min, slider_2_max+1)} | |
), | |
html.H4(children=slider_3_label), | |
dcc.Slider( | |
id='X3_slider', | |
min=slider_3_min, | |
max=slider_3_max, | |
step=0.1, | |
value=slider_3_mean, | |
marks={i: '{}'.format(i) for i in np.linspace(slider_3_min, slider_3_max,1+(slider_3_max-slider_3_min)*5)}, | |
), | |
# The predictin result will be displayed and updated here | |
html.H2(id="prediction_result"), | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment