diff --git a/bn_persona/persona_model.bif b/bn_persona/persona_model.bif deleted file mode 100644 index ef8062593b35916b8470d1079aefc607ab6c6d08..0000000000000000000000000000000000000000 --- a/bn_persona/persona_model.bif +++ /dev/null @@ -1,103 +0,0 @@ -network persona_model { -} - -%VARIABLES DEFINITION -variable reactivity { - type discrete [3] {slow, medium, fast}; -} -variable memory { - type discrete[3] {low, medium, high}; -} -variable attention { - type discrete[3] {low, medium, high}; -} -variable robot_assistance { - type discrete [ 5 ] { lev_0, lev_1, lev_2, lev_3, lev_4 }; -} -variable attempt { - type discrete [ 4 ] { att_1, att_2, att_3, att_4 }; -} -variable game_state { - type discrete [ 3 ] { beg, mid, end }; -} -variable robot_feedback { - type discrete [ 2 ] { yes, no }; -} -variable user_action { - type discrete [ 3 ] { correct, wrong, timeout }; -} - -%INDIVIDUAL PROBABILITIES DEFINITION -probability ( robot_assistance ) { - table 0.2, 0.2, 0.2, 0.2, 0.2; -} -probability ( game_state ) { - table 0.34, 0.33, 0.33; -} -probability ( attempt ) { - table 0.25, 0.25, 0.25, 0.25; -} -probability ( user_action ) { - table 0.33, 0.33, 0.34; -} -#CPDS 4 #SPECIFICALLY FOR THE GIVEN PATIENT -probability ( reactivity ) { - table 0.34, 0.33, 0.33; -} -#CPDS 3 #SPECIFICALLY FOR THE GIVEN PATIENT -probability ( memory ) { - table 0.33, 0.33, 0.34; -} -#CPDS 1 #SPECIFICALLY FOR THE GIVEN PATIENT -probability ( attention ) { - table 0.33, 0.33, 0.34; -} -probability ( robot_feedback ) { - table 0.5, 0.5; -} -probability ( reactivity | attention ) { - (low) 0.7, 0.2, 0.1; - (medium) 0.2, 0.5, 0.3; - (high) 0.1, 0.2, 0.7; -} -#CPDS 7 -probability (user_action | memory, reactivity) { -(low, slow) 0.2, 0.5, 0.3; -(low, medium) 0.3, 0.5, 0.2; -(low, fast) 0.4, 0.5, 0.1; -(medium, slow) 0.5, 0.3, 0.2; -(medium, medium) 0.55, 0.35, 0.1; -(medium, fast) 0.6, 0.4, 0.0; -(high, slow) 0.5, 0.4, 0.1; -(high, medium) 0.6, 0.3, 0.1; -(high, fast) 0.8, 0.2, 0.0; -} -#CPDS 5 -probability (robot_feedback | user_action) { - (correct) 0.8, 0.2; - (wrong) 0.5, 0.5; - (timeout) 0.2, 0.8; -} -#CPDS 6 -probability (robot_assistance | user_action) { - (correct) 0.05 0.1 0.15 0.3 0.4; - (wrong) 0.4 0.3 0.2 0.05 0.05; - (timeout) 0.4 0.4 0.1 0.05 0.05; -} -#CPDS 2 -probability (game_state | user_action) { - (correct) 0.2, 0.4, 0.4; - (wrong) 0.4, 0.4, 0.2; - (timeout) 0.6, 0.3, 0.1; -} -#CPDS 0 -probability (attempt | user_action) { - (correct) 0.1, 0.2, 0.3, 0.4; - (wrong) 0.5, 0.3, 0.15, 0.05; - (timeout) 0.4, 0.3, 0.2, 0.1; -} -#CPDS 5 -probability (robot_assistance | robot_feedback) { - (yes) 0.5 0.3 0.1 0.1 0.0; - (no) 0.0 0.1 0.1 0.3 0.5; -} \ No newline at end of file diff --git a/bn_persona/utilities.py b/bn_persona/utilities.py deleted file mode 100644 index adaf78b9191df6e5a2a3a44cd5f2ccbdfe6d6d71..0000000000000000000000000000000000000000 --- a/bn_persona/utilities.py +++ /dev/null @@ -1,70 +0,0 @@ -import random -import bn_functions - -def compute_next_state(user_action, task_evolution, attempt_counter, correct_move_counter, - wrong_move_counter, timeout_counter - ): - ''' - The function computes given the current state and action of the user, the next state - Args: - user_action: 0,1,2 - task_evolution: beg, mid, end - correct_move_counter: - attempt_counter: - wrong_move_counter: - timeout_counter: - Return: - the counters updated according to the user_action - ''' - if user_action == 0: - attempt_counter = 0 - task_evolution += 1 - correct_move_counter += 1 - # if the user made a wrong move and still did not reach the maximum number of attempts - elif user_action == 1 and attempt_counter < 3: - attempt_counter += 1 - wrong_move_counter += 1 - # if the user did not move any token and still did not reach the maximum number of attempts - elif user_action == 2 and attempt_counter < 3: - attempt_counter += 1 - timeout_counter += 1 - # the robot or therapist makes the correct move on the patient's behalf - else: - attempt_counter = 0 - task_evolution += 1 - correct_move_counter += 1 - - return task_evolution, attempt_counter, correct_move_counter, wrong_move_counter, timeout_counter - -def get_user_action_prob(): - - - - -def get_stochatic_action(actions_prob): - ''' - Select one of the actions according to the actions_prob - Args: - actions_prob: the probability of the Persona based on the BN to make a correct move, wrong move, timeout - Return: - the id of the selected action - N.B: - ''' - action_id = None - correct_action_from_BN = actions_prob[0] - wrong_action_from_BN = actions_prob[1] - timeout_action_from_BN = actions_prob[2] - - rnd_val = random.uniform(0,1) - #if user_prob is lower than the correct action prob then is the correct one - if rnd_val<=correct_action_from_BN: - action_id = 0 - #if rnd is larger than the correct action prob and lower than wrong - # action prob then is the wrong one - elif rnd_val>correct_action_from_BN \ - and rnd_val<(correct_action_from_BN+wrong_action_from_BN): - action_id = 1 - #timeout - else: - action_id = 2 - return action_id diff --git a/user_model.bif b/user_model.bif deleted file mode 100644 index 79daa7f3893c814a65ca7b186ade276a025ba4c1..0000000000000000000000000000000000000000 --- a/user_model.bif +++ /dev/null @@ -1,103 +0,0 @@ -network persona_model_4 { -} - -%VARIABLES DEFINITION -variable reactivity { - type discrete [3] {slow, medium, fast}; -} -variable memory { - type discrete[3] {low, medium, high}; -} -variable attention { - type discrete[3] {low, medium, high}; -} -variable robot_assistance { - type discrete [ 5 ] { lev_0, lev_1, lev_2, lev_3, lev_4 }; -} -variable attempt { - type discrete [ 4 ] { att_1, att_2, att_3, att_4 }; -} -variable game_state { - type discrete [ 3 ] { beg, mid, end }; -} -variable robot_feedback { - type discrete [ 2 ] { yes, no }; -} -variable user_action { - type discrete [ 3 ] { correct, wrong, timeout }; -} - -%INDIVIDUAL PROBABILITIES DEFINITION -probability ( robot_assistance ) { - table 0.2, 0.2, 0.2, 0.2, 0.2; -} -probability ( game_state ) { - table 0.34, 0.33, 0.33; -} -probability ( attempt ) { - table 0.25, 0.25, 0.25, 0.25; -} -probability ( user_action ) { - table 0.33, 0.33, 0.34; -} -#CPDS 4 #SPECIFICALLY FOR THE GIVEN PATIENT -probability ( reactivity ) { - table 0.34, 0.33, 0.33; -} -#CPDS 3 #SPECIFICALLY FOR THE GIVEN PATIENT -probability ( memory ) { - table 0.33, 0.33, 0.34; -} -#CPDS 1 #SPECIFICALLY FOR THE GIVEN PATIENT -probability ( attention ) { - table 0.33, 0.33, 0.34; -} -probability ( robot_feedback ) { - table 0.5, 0.5; -} -probability ( reactivity | attention ) { - (low) 0.5, 0.4, 0.1; - (medium) 0.3, 0.5, 0.2; - (high) 0.1, 0.2, 0.7; -} -#CPDS 7 -probability (user_action | memory, reactivity) { -(low, slow) 0.2, 0.5, 0.3; -(low, medium) 0.3, 0.5, 0.2; -(low, fast) 0.4, 0.5, 0.1; -(medium, slow) 0.5, 0.3, 0.2; -(medium, medium) 0.55, 0.35, 0.1; -(medium, fast) 0.6, 0.4, 0.0; -(high, slow) 0.5, 0.4, 0.1; -(high, medium) 0.6, 0.3, 0.1; -(high, fast) 0.8, 0.2, 0.0; -} -#CPDS 5 -probability (robot_feedback | user_action) { - (correct) 0.5, 0.5; - (wrong) 0.5, 0.5; - (timeout) 0.5, 0.5; -} -#CPDS 6 -probability (robot_assistance | user_action) { - (correct) 0.05 0.1 0.15 0.3 0.4; - (wrong) 0.4 0.2 0.2 0.1 0.1; - (timeout) 0.4 0.2 0.2 0.1 0.1; -} -#CPDS 2 -probability (game_state | user_action) { - (correct) 0.2, 0.4, 0.4; - (wrong) 0.4, 0.4, 0.2; - (timeout) 0.6, 0.3, 0.1; -} -#CPDS 0 -probability (attempt | user_action) { - (correct) 0.1, 0.2, 0.3, 0.4; - (wrong) 0.7, 0.2, 0.1, 0.0; - (timeout) 0.6, 0.3, 0.1, 0.0; -} -#CPDS 5 -probability (robot_assistance | robot_feedback) { - (yes) 0.5 0.3 0.1 0.1 0.0; - (no) 0.0 0.1 0.1 0.3 0.5; -} \ No newline at end of file