-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
61 lines (47 loc) · 1.74 KB
/
app.py
File metadata and controls
61 lines (47 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.
import dash
import dash_core_components as dcc
import pandas as pd
import numpy as np
import plotly.express as px
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from functools import reduce
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_score, StratifiedKFold
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import LabelBinarizer, OneHotEncoder, RobustScaler
from sklearn.compose import make_column_transformer
from process_data import *
# Reads the data
df = get_data()
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.title = 'Term Deposit Marketing Campaing '
# Create the webapp
app.layout = html.Div(children=[
html.H1(children='Term Deposit Marketing Campaing Dashboard'),
dcc.Graph(figure=label_counts(df)),
dcc.Graph(figure=plot_monthly_success(df)),
dcc.Graph(figure=box_plot_cont(df)),
dcc.Graph(id="cat-graph"),
dcc.Dropdown(
id='cat-dropdown',
options=[{"label": c, "value": c} for c in categorical_features],
value='job'
),
dcc.Graph(figure=logistic_feature_importance(df)),
])
@app.callback(
Output('cat-graph', 'figure'),
[Input('cat-dropdown', 'value')])
def update_cities(column):
return bar_plot_disc_variables(df, column)
application = app.server
if __name__ == '__main__':
app.run_server(debug=False, port=8050, host='0.0.0.0')