James McCool
commited on
Commit
·
20665ec
1
Parent(s):
51ae6c5
Update trimming options in app.py: replace 'Geomean' with 'Product Own' for portfolio calculations, and ensure trimming logic is executed only upon form submission for improved user experience.
Browse files- app.py +4 -3
- global_func/predict_dupes.py +1 -1
app.py
CHANGED
@@ -804,10 +804,11 @@ with tab3:
|
|
804 |
with st.expander('Trimming Options'):
|
805 |
with st.form(key='trim_form'):
|
806 |
performance_type = st.selectbox("Select sort type", ['median', 'Finish_percentile'])
|
807 |
-
own_type = st.selectbox("Select trimming variable type", ['Own', '
|
808 |
-
|
809 |
-
|
810 |
submitted = st.form_submit_button("Trim")
|
|
|
|
|
811 |
|
812 |
with col2:
|
813 |
st.session_state['portfolio'] = predict_dupes(st.session_state['portfolio'], map_dict, site_var, type_var, Contest_Size, strength_var)
|
|
|
804 |
with st.expander('Trimming Options'):
|
805 |
with st.form(key='trim_form'):
|
806 |
performance_type = st.selectbox("Select sort type", ['median', 'Finish_percentile'])
|
807 |
+
own_type = st.selectbox("Select trimming variable type", ['Own', 'Product Own'])
|
808 |
+
|
|
|
809 |
submitted = st.form_submit_button("Trim")
|
810 |
+
if submitted:
|
811 |
+
st.session_state['portfolio'] = trim_portfolio(st.session_state['portfolio'], performance_type, own_type)
|
812 |
|
813 |
with col2:
|
814 |
st.session_state['portfolio'] = predict_dupes(st.session_state['portfolio'], map_dict, site_var, type_var, Contest_Size, strength_var)
|
global_func/predict_dupes.py
CHANGED
@@ -182,7 +182,7 @@ def predict_dupes(portfolio, maps_dict, site_var, type_var, Contest_Size, streng
|
|
182 |
portfolio['Lineup Edge'] = portfolio['Win%'] * ((.5 - portfolio['Finish_percentile']) * (Contest_Size / 2.5))
|
183 |
portfolio['Lineup Edge'] = portfolio.apply(lambda row: row['Lineup Edge'] / (row['Dupes'] + 1) if row['Dupes'] > 0 else row['Lineup Edge'], axis=1)
|
184 |
portfolio['Lineup Edge'] = portfolio['Lineup Edge'] - portfolio['Lineup Edge'].mean()
|
185 |
-
portfolio['
|
186 |
portfolio = portfolio.drop(columns=dup_count_columns)
|
187 |
portfolio = portfolio.drop(columns=own_columns)
|
188 |
portfolio = portfolio.drop(columns=calc_columns)
|
|
|
182 |
portfolio['Lineup Edge'] = portfolio['Win%'] * ((.5 - portfolio['Finish_percentile']) * (Contest_Size / 2.5))
|
183 |
portfolio['Lineup Edge'] = portfolio.apply(lambda row: row['Lineup Edge'] / (row['Dupes'] + 1) if row['Dupes'] > 0 else row['Lineup Edge'], axis=1)
|
184 |
portfolio['Lineup Edge'] = portfolio['Lineup Edge'] - portfolio['Lineup Edge'].mean()
|
185 |
+
portfolio['Product Own'] = portfolio[own_columns].product(axis=1).mean() * 100
|
186 |
portfolio = portfolio.drop(columns=dup_count_columns)
|
187 |
portfolio = portfolio.drop(columns=own_columns)
|
188 |
portfolio = portfolio.drop(columns=calc_columns)
|