Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -115,7 +115,7 @@ def train_model(X,labels):
|
|
115 |
return
|
116 |
train_data = lgb.Dataset(X, label=labels)
|
117 |
num_round = 10
|
118 |
-
param = {'num_leaves':
|
119 |
bst = lgb.train(param, train_data, num_round)
|
120 |
in_sample_preds = bst.predict(X)
|
121 |
in_sample_score = np.corrcoef([in_sample_preds,np.array(labels)])[0][1]
|
@@ -177,7 +177,12 @@ if st.session_state.name:
|
|
177 |
setup_user()
|
178 |
|
179 |
st.subheader(f"Let's start {st.session_state.name}")
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
181 |
filename = get_filename()
|
182 |
|
183 |
|
@@ -190,12 +195,17 @@ if st.session_state.name:
|
|
190 |
c1,c2 = cc2.columns(2)
|
191 |
if st.session_state.count>30 and st.session_state.pos > 5 and st.session_state.neg > 5:
|
192 |
c1.button('Train',on_click=train,args=[])
|
|
|
|
|
|
|
193 |
c2.button('Start over',on_click=cleanup,args=[])
|
194 |
if 'preds' in st.session_state:
|
195 |
|
196 |
cc1.write('Here is our guess')
|
197 |
-
cc1.
|
198 |
-
|
|
|
|
|
199 |
best,worst = get_extremes()
|
200 |
|
201 |
cc2.subheader('Predicted best')
|
@@ -210,7 +220,7 @@ if st.session_state.name:
|
|
210 |
c.metric("", f'{pred:.0%}')
|
211 |
c.image(get_s3_url(file), width = 100)
|
212 |
|
213 |
-
|
214 |
|
215 |
cc1.subheader('Where you confused me')
|
216 |
|
|
|
115 |
return
|
116 |
train_data = lgb.Dataset(X, label=labels)
|
117 |
num_round = 10
|
118 |
+
param = {'num_leaves':50, 'objective': 'binary', 'metric' : 'auc', 'lambda_l2': 0.1, 'max_depth':5}
|
119 |
bst = lgb.train(param, train_data, num_round)
|
120 |
in_sample_preds = bst.predict(X)
|
121 |
in_sample_score = np.corrcoef([in_sample_preds,np.array(labels)])[0][1]
|
|
|
177 |
setup_user()
|
178 |
|
179 |
st.subheader(f"Let's start {st.session_state.name}")
|
180 |
+
c1,c2 = st.columns(2)
|
181 |
+
my_bar = c1.progress(min(st.session_state.count/40,1.))
|
182 |
+
p_liked = (st.session_state.pos / st.session_state.count) if st.session_state.count else 0
|
183 |
+
c2.metric('%age liked so far',f'{p_liked:.1%}')
|
184 |
+
|
185 |
+
|
186 |
filename = get_filename()
|
187 |
|
188 |
|
|
|
195 |
c1,c2 = cc2.columns(2)
|
196 |
if st.session_state.count>30 and st.session_state.pos > 5 and st.session_state.neg > 5:
|
197 |
c1.button('Train',on_click=train,args=[])
|
198 |
+
if st.session_state.count == 31:
|
199 |
+
st.balloons()
|
200 |
+
st.toast('Ready for training')
|
201 |
c2.button('Start over',on_click=cleanup,args=[])
|
202 |
if 'preds' in st.session_state:
|
203 |
|
204 |
cc1.write('Here is our guess')
|
205 |
+
c1,c2 = cc1.columns(2)
|
206 |
+
c1.metric("Probability you will like", f'{st.session_state.pred:.1%}')
|
207 |
+
c2.metric("Overall model accuracy", f'{st.session_state.score:.0%}')
|
208 |
+
|
209 |
best,worst = get_extremes()
|
210 |
|
211 |
cc2.subheader('Predicted best')
|
|
|
220 |
c.metric("", f'{pred:.0%}')
|
221 |
c.image(get_s3_url(file), width = 100)
|
222 |
|
223 |
+
|
224 |
|
225 |
cc1.subheader('Where you confused me')
|
226 |
|