Skip to content

Commit

Permalink
improve declarer direction prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
BSalita committed Feb 2, 2024
1 parent b3a133a commit 8d59eaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def ask_questions_without_context(ups, model=None):
function_calls = st.session_state.function_calls
# ups can be a string, list of strings, or list of lists of strings.
assert isinstance(ups, list), ups
with st.spinner(f"Morty is thinking ..."): # {len(ups)} responses from {model}."):
with st.spinner(f"Morty is judging you ..."): # {len(ups)} responses from {model}."):
tasks = []
list_of_new_messages = []
for i, up in enumerate(ups):
Expand Down Expand Up @@ -885,7 +885,8 @@ def Predict_Game_Results():
predicted_declarer_direction = [class_labels[l.argmax().item()] for l in predicted_declarer_direction_NESW_probs]
st.session_state.df[y_name+'_Actual'] = st.session_state.df[y_name]
st.session_state.df[y_name+'_Pred'] = predicted_declarer_direction
st.session_state.df['Declarer_Number_Pred'] = st.session_state.df.apply(lambda r: r['Player_Number_'+r[y_name+'_Actual']],axis='columns')
st.session_state.df['Declarer_Number_Pred'] = st.session_state.df.apply(lambda r: r['Player_Number_'+r[y_name+'_Pred']],axis='columns')
st.session_state.df['Declarer_Name_Pred'] = st.session_state.df.apply(lambda r: r['Player_Name_'+r[y_name+'_Pred']],axis='columns')
st.session_state.df[y_name+'_Match'] = st.session_state.df[y_name+'_Actual'] == st.session_state.df[y_name+'_Pred']
st.session_state.df['Declarer_Pair_Direction_Match'] = st.session_state.df.apply(lambda r: (r[y_name+'_Actual'] in 'NS') == (r[y_name+'_Pred'] in 'NS'),axis='columns')

Expand Down
4 changes: 2 additions & 2 deletions default.favorites.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@
"prompts": [
{
"prompt": "",
"sql": "SELECT Board, ANY_VALUE(Parscore_NS) AS Parscore_NS, ANY_VALUE(Declarer_Direction_Pred) AS Predicted_Declarer, COUNT() AS Board_Plays, SUM(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN 1 ELSE 0 END) AS Correct_Preds, Correct_Preds/Board_Plays AS Correct_Direction_Pct, SUM(CASE WHEN (Declarer_Direction IN ('N','S') AND Declarer_Direction_Pred IN ('N', 'S')) OR (Declarer_Direction IN ('E','W') AND Declarer_Direction_Pred IN ('E', 'W')) THEN 1 ELSE 0 END) AS Correct_Pair_Preds, Correct_Pair_Preds/Board_Plays AS Correct_Pair_Pct FROM results GROUP BY Board ORDER BY Board"
"sql": "SELECT Board, ANY_VALUE(Parscore_NS) AS Parscore_NS, Declarer_Direction_Pred, COUNT() AS Board_Plays, SUM(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN 1 ELSE 0 END) AS Correct_Preds, Correct_Preds/Board_Plays AS Correct_Direction_Pct, SUM(CASE WHEN (Declarer_Direction IN ('N','S') AND Declarer_Direction_Pred IN ('N', 'S')) OR (Declarer_Direction IN ('E','W') AND Declarer_Direction_Pred IN ('E', 'W')) THEN 1 ELSE 0 END) AS Correct_Pair_Preds, Correct_Pair_Preds/Board_Plays AS Correct_Pair_Pct FROM results GROUP BY Board, Declarer_Direction_Pred ORDER BY Board"
}
]
},
Expand All @@ -551,7 +551,7 @@
"prompts": [
{
"prompt": "",
"sql": "SELECT CONCAT(Declarer_Number_Pred, ' - ', Name_Declarer, ' - ', Declarer_Direction_Pred) AS Player, SUM(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN 1 ELSE 0 END) AS Correct_Preds, COUNT() AS Boards_Declared, STRING_AGG(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN Board END, ', ') AS Correctly_Pred_Boards, STRING_AGG(CASE WHEN Declarer_Direction <> Declarer_Direction_Pred THEN Board END, ', ') AS Predicted_Not_Declared, Correct_Preds/Boards_Declared AS Correct_Direction_Pct, SUM(CASE WHEN (Declarer_Direction IN ('N','S') AND Declarer_Direction_Pred IN ('N', 'S')) OR (Declarer_Direction IN ('E','W') AND Declarer_Direction_Pred IN ('E', 'W')) THEN 1 ELSE 0 END) AS Correct_Pair_Preds, Correct_Pair_Preds/Boards_Declared AS Correct_Pair_Pct FROM results GROUP BY Declarer_Number_Pred, Name_Declarer, Declarer_Direction_Pred ORDER BY Correct_Direction_Pct DESC, Boards_Declared DESC"
"sql": "SELECT CONCAT(Declarer_Number_Pred, ' - ', Declarer_Name_Pred, ' - ', Declarer_Direction_Pred) AS Player, SUM(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN 1 ELSE 0 END) AS Correct_Preds, COUNT() AS Pred_To_Declare, STRING_AGG(CASE WHEN Declarer_Direction = Declarer_Direction_Pred THEN Board END, ', ') AS Correctly_Pred_Boards, STRING_AGG(CASE WHEN Declarer_Direction <> Declarer_Direction_Pred THEN Board END, ', ') AS Predicted_Not_Declared, Correct_Preds/Pred_To_Declare AS Correct_Direction_Pct, SUM(CASE WHEN (Declarer_Direction IN ('N','S') AND Declarer_Direction_Pred IN ('N', 'S')) OR (Declarer_Direction IN ('E','W') AND Declarer_Direction_Pred IN ('E', 'W')) THEN 1 ELSE 0 END) AS Correct_Pair_Preds, Correct_Pair_Preds/Pred_To_Declare AS Correct_Pair_Pct FROM results GROUP BY Declarer_Number_Pred, Declarer_Name_Pred, Declarer_Direction_Pred ORDER BY Correct_Direction_Pct DESC, Pred_To_Declare DESC"
}
]
},
Expand Down

0 comments on commit 8d59eaf

Please sign in to comment.