Skip to content
Snippets Groups Projects
Commit 4aaa0934 authored by Antonio Andriella's avatar Antonio Andriella
Browse files

New persona model and test class

parent f9c97845
No related branches found
No related tags found
No related merge requests found
network persona_model {
}
%VARIABLES DEFINITION
variable robot_assistance {
type discrete [ 6 ] { lev_0, lev_1, lev_2, lev_3, lev_4, lev_5 };
}
variable attempt_t0 {
type discrete [ 4 ] { att_1, att_2, att_3, att_4 };
}
variable game_state_t0 {
type discrete [ 3 ] { beg, mid, end };
}
variable attempt_t1 {
type discrete [ 4 ] { att_1, att_2, att_3, att_4 };
}
variable game_state_t1 {
type discrete [ 3 ] { beg, mid, end };
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
variable user_action {
type discrete [ 3 ] { correct, wrong, timeout };
}
%INDIVIDUAL PROBABILITIES DEFINITION
probability ( robot_assistance ) {
table 0.17, 0.16, 0.16, 0.17, 0.17, 0.17;
}
probability ( game_state_t0 ) {
table 0.34, 0.33, 0.33;
}
probability ( attempt_t0 ) {
table 0.25, 0.25, 0.25, 0.25;
}
probability ( game_state_t1 ) {
table 0.34, 0.33, 0.33;
}
probability ( attempt_t1 ) {
table 0.25, 0.25, 0.25, 0.25;
}
probability ( user_action ) {
table 0.33, 0.33, 0.34;
}
probability (robot_assistance | game_state_t0, attempt_t0){
(beg, att_1) 0.0, 0.2, 0.2, 0.2, 0.2, 0.2;
(beg, att_2) 0.05, 0.15, 0.2, 0.2, 0.2, 0.2;
(beg, att_3) 0.1, 0.2, 0.2, 0.2, 0.2, 0.1;
(beg, att_4) 0.15, 0.05, 0.2, 0.2, 0.2, 0.2;
(mid, att_1) 0.0, 0.2, 0.2, 0.2, 0.2, 0.2;
(mid, att_2) 0.05, 0.15, 0.2, 0.2, 0.2, 0.2;
(mid, att_3) 0.1, 0.2, 0.2, 0.2, 0.2, 0.1;
(mid, att_4) 0.15, 0.05, 0.2, 0.2, 0.2, 0.2;
(end, att_1) 0.0, 0.2, 0.2, 0.2, 0.2, 0.2;
(end, att_2) 0.05, 0.15, 0.2, 0.2, 0.2, 0.2;
(end, att_3) 0.1, 0.2, 0.2, 0.2, 0.2, 0.1;
(end, att_4) 0.15, 0.05, 0.2, 0.2, 0.2, 0.2;
}
probability (user_action | game_state_t0, attempt_t0, robot_assistance){
(beg, att_1, lev_0) 0.1, 0.9, 0.0;
(beg, att_2, lev_0) 0.2, 0.8, 0.0;
(beg, att_3, lev_0) 0.3, 0.7, 0.0;
(beg, att_4, lev_0) 0.4, 0.6, 0.0;
(beg, att_1, lev_1) 0.1, 0.9, 0.0;
(beg, att_2, lev_1) 0.2, 0.8, 0.0;
(beg, att_3, lev_1) 0.3, 0.7, 0.0;
(beg, att_4, lev_1) 0.4, 0.6, 0.0;
(beg, att_1, lev_2) 0.1, 0.9, 0.0;
(beg, att_2, lev_2) 0.2, 0.8, 0.0;
(beg, att_3, lev_2) 0.3, 0.7, 0.0;
(beg, att_4, lev_2) 0.4, 0.6, 0.0;
(beg, att_1, lev_3) 0.1, 0.9, 0.0;
(beg, att_2, lev_3) 0.2, 0.8, 0.0;
(beg, att_3, lev_3) 0.3, 0.7, 0.0;
(beg, att_4, lev_3) 0.4, 0.6, 0.0;
(beg, att_1, lev_4) 0.1, 0.9, 0.0;
(beg, att_2, lev_4) 0.2, 0.8, 0.0;
(beg, att_3, lev_4) 0.3, 0.7, 0.0;
(beg, att_4, lev_4) 0.4, 0.6, 0.0;
(beg, att_1, lev_5) 0.1, 0.9, 0.0;
(beg, att_2, lev_5) 0.2, 0.8, 0.0;
(beg, att_3, lev_5) 0.3, 0.7, 0.0;
(beg, att_4, lev_5) 0.4, 0.6, 0.0;
(mid, att_1, lev_0) 0.1, 0.9, 0.0;
(mid, att_2, lev_0) 0.2, 0.8, 0.0;
(mid, att_3, lev_0) 0.3, 0.7, 0.0;
(mid, att_4, lev_0) 0.4, 0.6, 0.0;
(mid, att_1, lev_1) 0.1, 0.9, 0.0;
(mid, att_2, lev_1) 0.2, 0.8, 0.0;
(mid, att_3, lev_1) 0.3, 0.7, 0.0;
(mid, att_4, lev_1) 0.4, 0.6, 0.0;
(mid, att_1, lev_2) 0.1, 0.9, 0.0;
(mid, att_2, lev_2) 0.2, 0.8, 0.0;
(mid, att_3, lev_2) 0.3, 0.7, 0.0;
(mid, att_4, lev_2) 0.4, 0.6, 0.0;
(mid, att_1, lev_3) 0.1, 0.9, 0.0;
(mid, att_2, lev_3) 0.2, 0.8, 0.0;
(mid, att_3, lev_3) 0.3, 0.7, 0.0;
(mid, att_4, lev_3) 0.4, 0.6, 0.0;
(mid, att_1, lev_4) 0.1, 0.9, 0.0;
(mid, att_2, lev_4) 0.2, 0.8, 0.0;
(mid, att_3, lev_4) 0.3, 0.7, 0.0;
(mid, att_4, lev_4) 0.4, 0.6, 0.0;
(mid, att_1, lev_5) 0.1, 0.9, 0.0;
(mid, att_2, lev_5) 0.2, 0.8, 0.0;
(mid, att_3, lev_5) 0.3, 0.7, 0.0;
(mid, att_4, lev_5) 0.4, 0.6, 0.0;
(end, att_1, lev_0) 0.1, 0.9, 0.0;
(end, att_2, lev_0) 0.2, 0.8, 0.0;
(end, att_3, lev_0) 0.2, 0.8, 0.0;
(end, att_4, lev_0) 0.4, 0.6, 0.0;
(end, att_1, lev_1) 0.1, 0.9, 0.0;
(end, att_2, lev_1) 0.2, 0.8, 0.0;
(end, att_3, lev_1) 0.4, 0.6, 0.0;
(end, att_4, lev_1) 0.4, 0.6, 0.0;
(end, att_1, lev_2) 0.1, 0.9, 0.0;
(end, att_2, lev_2) 0.2, 0.8, 0.0;
(end, att_3, lev_2) 0.4, 0.6, 0.0;
(end, att_4, lev_2) 0.4, 0.6, 0.0;
(end, att_1, lev_3) 0.1, 0.9, 0.0;
(end, att_2, lev_3) 0.2, 0.8, 0.0;
(end, att_3, lev_3) 0.5, 0.5, 0.0;
(end, att_4, lev_3) 0.4, 0.6, 0.0;
(end, att_1, lev_4) 0.1, 0.9, 0.0;
(end, att_2, lev_4) 0.2, 0.8, 0.0;
(end, att_3, lev_4) 0.7, 0.3, 0.0;
(end, att_4, lev_4) 0.4, 0.6, 0.0;
(end, att_1, lev_5) 0.1, 0.9, 0.0;
(end, att_2, lev_5) 0.2, 0.8, 0.0;
(end, att_3, lev_5) 0.3, 0.7, 0.0;
(end, att_4, lev_5) 0.4, 0.6, 0.0;
}
probability (game_state_t1 | user_action) {
(correct) 0.2, 0.3, 0.5;
(wrong) 0.5, 0.3, 0.2;
(timeout) 0.33, 0.34, 0.33;
}
probability (attempt_t1 | user_action) {
(correct) 0.1, 0.2, 0.3, 0.4;
(wrong) 0.4, 0.3, 0.2, 0.1;
(timeout) 0.25, 0.25, 0.25, 0.25;
}
probability (user_action | robot_assistance){
(lev_0) 0.1, 0.6, 0.3;
(lev_1) 0.2, 0.5, 0.3;
(lev_2) 0.3, 0.5, 0.2;
(lev_3) 0.5, 0.3, 0.2;
(lev_4) 0.9, 0.1, 0.0;
(lev_5) 0.9, 0.1, 0.0;
}
\ No newline at end of file
test.py 0 → 100644
import bnlearn as bn
DAG = bn.import_DAG('bn_persona_model/persona_model_test.bif')
#df = bn.sampling(DAG, n=1000, verbose=2)
#model = bn.structure_learning.fit(df)
#G = bn.plot(model)
#DAGnew = bn.parameter_learning.fit(model, df, methodtype="bayes")
#bn.print_CPD(DAGnew)
q1 = bn.inference.fit(DAG, variables=['user_action'], evidence={
'game_state_t0': 1,
'attempt_t0':0,
'robot_assistance':5,
'game_state_t1': 1,
'attempt_t0':1,
})
print(q1.variables)
print(q1.values)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment