-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample_app.py
163 lines (127 loc) · 3.16 KB
/
example_app.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import streamlit as st
import fancylit
import pandas as pd
from sklearn.linear_model import Lasso
###
# Streamlit Main Functionality
###
def stats_examples(df: pd.DataFrame) -> None:
"""
Purpose:
Shows examples for modeling
Args:
N/A
Returns:
N/A
"""
# Stats Example
st.write("Describe Example")
with st.echo():
fancylit.stats.df_describe(df)
fancylit.stats.show_metrics(df)
fancylit.stats.gen_wordcloud(df)
def modeling_viz_examples(df: pd.DataFrame) -> None:
"""
Purpose:
Shows examples for modeling
Args:
N/A
Returns:
N/A
"""
# classification_report example
st.write("Classification Report Example")
with st.echo():
fancylit.yellowbrick_funcs.show_classification_report(df)
st.write("Feature Correlation")
with st.echo():
fancylit.yellowbrick_funcs.feature_correlation(df)
st.write("Class balance")
with st.echo():
fancylit.yellowbrick_funcs.class_balance(df)
# st.write("UMAP Corpus Visualization Example")
# with st.echo():
# fancylit.yellowbrick_funcs.umap_viz(df)
st.write("Prediction Error Plot")
with st.echo():
fancylit.yellowbrick_funcs.prediction_error(df, Lasso())
def viz_examples(df: pd.DataFrame) -> None:
"""
Purpose:
Shows examples for viz
Args:
N/A
Returns:
N/A
"""
# Start bar chart example
st.write("Bar Chart Example")
with st.echo():
fancylit.viz.charts.bar_chart(df)
st.write("3D Chart Example")
with st.echo():
fancylit.viz.charts.chart_3d(df)
# Start pair plot example
st.write("Pair Plot Example")
with st.echo():
fancylit.viz.charts.pair_plot(df)
# Start Scatter Plot example
st.write("Scatter Plot Example")
with st.echo():
fancylit.viz.charts.scatter_plot(df)
# Start Line Chart example
st.write("Line Chart Example")
with st.echo():
fancylit.viz.charts.line_chart(df)
# Start heatmap example
st.write("Heatmap Example")
with st.echo():
fancylit.viz.charts.heatmap(df)
def sidebar() -> None:
"""
Purpose:
Shows the side bar
Args:
N/A
Returns:
N/A
"""
st.sidebar.header(f"Fancylit Example")
def app() -> None:
"""
Purpose:
Controls the app flow
Args:
N/A
Returns:
N/A
"""
# Spin up the sidebar
# sidebar()
# load example csv
df = pd.read_csv("datasets/iris.csv")
st.header("Fancylit Examples")
st.write(
"The following examples highlight what fancylit can do using the following dataset")
st.write("Iris CSV data")
st.write(df)
# Start examples
st.subheader("Stats Examples")
stats_examples(df)
st.subheader("Viz Examples")
viz_examples(df)
st.subheader("Modeling Examples")
modeling_viz_examples(df)
def main() -> None:
"""
Purpose:
Controls the flow of the streamlit app
Args:
N/A
Returns:
N/A
"""
# Start the streamlit app
app()
if __name__ == "__main__":
main()