Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
ToM Project Medical
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Erdogan, E. (Emre)
ToM Project Medical
Commits
9d2c2354
Commit
9d2c2354
authored
1 year ago
by
Erdogan, E. (Emre)
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
685bb375
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doctorhuman.py
+66
-0
66 additions, 0 deletions
doctorhuman.py
with
66 additions
and
0 deletions
doctorhuman.py
0 → 100644
+
66
−
0
View file @
9d2c2354
class
DoctorHuman
:
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
beliefbase
=
[]
self
.
abs_1
=
"
L_Y_good_communication_X
"
self
.
abs_2
=
"
L_Y_good_capabilities_X
"
self
.
expected_action_1
=
"
discuss
"
self
.
expected_action_2
=
"
agree
"
self
.
expected_action_3
=
"
persuade
"
self
.
expected_action_4
=
"
consult
"
self
.
relevant_beliefs
=
[
self
.
abs_1
,
self
.
abs_2
]
self
.
trust_y_x
=
0
self
.
unexpected_agent_actions
=
0
self
.
unexpected_agent_action_alert
=
0
def
init_human
(
self
,
abs_1_value
,
abs_2_value
):
self
.
beliefbase
.
append
([
self
.
abs_1
,
abs_1_value
])
self
.
beliefbase
.
append
([
self
.
abs_2
,
abs_2_value
])
self
.
abstraction
()
def
add_belief
(
self
,
belief
,
round
):
if
not
self
.
beliefbase
.
__contains__
(
belief
):
#check if belief is in the beliefbase
#print("not found")
opposite_value
=
(
belief
[
1
]
+
1
)
%
2
if
self
.
beliefbase
.
__contains__
([
belief
[
0
],
opposite_value
]):
#if the opposite belief is in the beliefbase, revise it with the new value
belief_index
=
self
.
beliefbase
.
index
([
belief
[
0
],
opposite_value
])
self
.
beliefbase
[
belief_index
][
1
]
=
belief
[
1
]
else
:
#if the belief does not exist at all, add it to the beliefbase
self
.
beliefbase
.
append
(
belief
)
def
abstraction
(
self
):
if
self
.
beliefbase
.
__contains__
([
self
.
abs_1
,
1
])
and
self
.
beliefbase
.
__contains__
([
self
.
abs_2
,
1
]):
self
.
trust_y_x
=
1
else
:
self
.
trust_y_x
=
0
def
deliberation_critic
(
self
,
agent_action
):
#designed for second experiment in which agent does not trust human
self
.
unexpected_agent_action_alert
=
0
self
.
abstraction
()
if
(
self
.
trust_y_x
==
1
and
agent_action
==
self
.
expected_action_4
)
or
(
self
.
trust_y_x
==
0
and
agent_action
==
self
.
expected_action_3
):
self
.
unexpected_agent_actions
+=
1
self
.
unexpected_agent_action_alert
=
1
#print("alert")
def
deliberation_critic2
(
self
,
agent_action
):
#designed for third experiment in which agent trusts human
self
.
unexpected_agent_action_alert
=
0
self
.
abstraction
()
if
(
self
.
trust_y_x
==
1
and
agent_action
==
self
.
expected_action_2
)
or
(
self
.
trust_y_x
==
0
and
agent_action
==
self
.
expected_action_1
):
self
.
unexpected_agent_actions
+=
1
self
.
unexpected_agent_action_alert
=
1
#print("alert")
def
tell_belief_values
(
self
,
beliefs
):
answered_beliefs
=
[]
for
i
in
range
(
0
,
len
(
beliefs
)):
if
self
.
beliefbase
.
__contains__
([
beliefs
[
i
],
0
]):
belief_index
=
self
.
beliefbase
.
index
([
beliefs
[
i
],
0
])
answered_beliefs
.
append
(
self
.
beliefbase
[
belief_index
])
elif
self
.
beliefbase
.
__contains__
([
beliefs
[
i
],
1
]):
belief_index
=
self
.
beliefbase
.
index
([
beliefs
[
i
],
1
])
answered_beliefs
.
append
(
self
.
beliefbase
[
belief_index
])
else
:
print
(
"
belief is not found in the beliefbase
"
)
return
answered_beliefs
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment