Truth-tracking in explanatory reasoning: power vs goodness
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
breed [power-seekers power-seeker] breed [goodness-seekers goodness-seeker] globals [ truth-freq-h1 current-truth truth-likelihood falsity-likelihood truth-prior-ps truth-prior-gs prop-truth-ps prop-truth-gs stopping-tick falsity-prior-ps falsity-prior-gs ] turtles-own [ count-h1 ; number of times h1 is better than h2 count-h2 ; number of times h2 is better than h1 prior-h1 ; prior credence in h1 prior-h2 ; prior credence in h2 prop-h1 ; prop of times h1 is the best explanation (prop-h1 = count-h1/[count-h1 + count-h2]) prop-h2 ; prop of times h2 is the best explanation (prop-h2 = count-h2/[count-h1 + count-h2]) strategy ; update strategy truth-alignment ; tracks whether the agent aligns with the ground truth k1 ; variable to make calculations of EG_1 and EG_2 simpler k2 ; variable to make calculations of EG_1 and EG_2 simpler EP_1 ; value of power for h1 EP_2 ; value of power for h2 EG_1 ; value of goodness for h1 EG_2 ; value of goodness for h2 preferred-hypothesis ; truth-alignment variable truth-hit? p-h1 p-h2 brier logscore ] patches-own [ likelihood-h1 ; represents strength of evidence for h2 on this patch – i.e., P(e|h1) likelihood-h2 ; represents strength of evidence for h2 on this patch – i.e., P(e|h2) ] ; Truth-alignment reporter to-report alignment-of [ agset ] report mean [ truth-hit? ] of agset ;; simple average of 0/1 end to-report brier-of-ps report mean [brier] of power-seekers end to-report brier-of-gs report mean [brier] of goodness-seekers end ; initialize the world to setup clear-all setup-patches setup-turtles ; set up truth-freq according to a condition if condition = "tps" [set truth-freq-h1 round (avg-prior-h1-goodness-seekers * 100)] if condition = "sto" [set truth-freq-h1 round (random 100)] if condition = "nor" [ let raw-freq random-normal (avg-prior-h1-goodness-seekers * 100) 25 let rounded-freq round raw-freq set truth-freq-h1 max list 0 min list 100 rounded-freq ] ; set the ground truth for the entire run. ifelse random 100 <= truth-freq-h1 [ set current-truth "h1"][ set current-truth "h2"] reset-ticks end ; create evidence patches to setup-patches ask patches [ set likelihood-h1 max list 0 min list 1 (random-normal avg-likelihood-h1 0.2) ; each patch has P(e|h1) between 0.001 and the number assigned by the slider if likelihood-h1 < 0.001 [ set likelihood-h1 0.001 ] ; ensures NetLogo doesn't go crazy with logarithms of small numbers set likelihood-h2 max list 0 min list 1 (random-normal avg-likelihood-h2 0.2) ; each patch has P(e|h2) between 0.001 and the number assigned by the slider if likelihood-h2 < 0.001 [ set likelihood-h2 0.001 ] ; ensures NetLogo's doesn't go crazy with logarithms of small numbers ; calculate set color based on the dominant likelihood let likelihood-diff likelihood-h1 - likelihood-h2 if likelihood-diff > 1 [ set pcolor scale-color green likelihood-diff 0 1 ; darker green as likelihood-diff increases ] if likelihood-diff < 1 [ set pcolor scale-color green (1 - likelihood-diff) 0 1 ; lighter green as likelihood-diff decreases ] if likelihood-diff = 0 [ set pcolor green ; set to pure green when the likelihoods are the same ] ] end ; create agents to setup-turtles create-power-seekers number-of-turtles-each [ set color red set count-h1 0 set count-h2 0 set prop-h1 0 set prop-h2 0 set prior-h1 max list 0 min list 1 (random-normal avg-prior-h1-power-seekers sd-priors-ps) if prior-h1 > 1 [set prior-h1 1] set prior-h2 (1 - prior-h1) if prior-h1 > 1 [set prior-h1 1] set strategy "power" setxy random-xcor random-ycor ] create-goodness-seekers number-of-turtles-each [ set color blue set count-h1 0 set count-h2 0 set prop-h1 0 set prop-h2 0 set prior-h1 max list 0 min list 1 (random-normal avg-prior-h1-goodness-seekers sd-priors-gs) if prior-h1 > 1 [set prior-h1 1] set prior-h2 (1 - prior-h1) if prior-h1 > 1 [set prior-h1 1] set strategy "goodness" ; strategy type setxy random-xcor random-ycor ; place them randomly in the world ] end ; main update loop to go ask turtles [ move update ] update-plot ;update-plot1 update-histogram update-disagreement-plot update-truth-alignment-plot if ticks >= total-ticks [stop] ;stopping condition tick end ; turtles move randomly to move rt random 360 fd 1 end ;;;;;;;;;;;;;;;;;;;;;;;;STRATEGIES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set strategies to update let evidence-here-h1 [likelihood-h1] of patch-here let evidence-here-h2 [likelihood-h2] of patch-here if current-truth = "h1" [ set truth-prior-ps avg-prior-h1-power-seekers set falsity-prior-ps 1 - avg-prior-h1-power-seekers set truth-prior-gs avg-prior-h1-goodness-seekers set falsity-prior-gs 1 - avg-prior-h1-goodness-seekers set truth-likelihood avg-likelihood-h1 set falsity-likelihood avg-likelihood-h2 set prop-truth-ps mean [prop-h1] of power-seekers set prop-truth-gs mean [prop-h1] of goodness-seekers] if current-truth = "h2" [ set truth-prior-ps 1 - avg-prior-h1-power-seekers set falsity-prior-ps avg-prior-h1-power-seekers set truth-prior-gs 1 - avg-prior-h1-goodness-seekers set falsity-prior-gs avg-prior-h1-goodness-seekers set truth-likelihood avg-likelihood-h2 set falsity-likelihood avg-likelihood-h1 set prop-truth-ps mean [prop-h2] of power-seekers set prop-truth-gs mean [prop-h2] of goodness-seekers ] if strategy = "power" [ ;power-seekers strategy let P_e (evidence-here-h1 * prior-h1 + evidence-here-h2 * prior-h2) ; computes P(e) using the rule of total probability ;explanatory power set EP_1 (log evidence-here-h1 10) - (log P_e 10) set EP_2 (log evidence-here-h2 10) - (log P_e 10) ;comparison procedure if EP_1 > EP_2 [set count-h1 count-h1 + 1] if EP_2 > EP_1 [set count-h2 count-h2 + 1] ;updating procedure if p-s-bayes-updating? [ set prior-h1 (evidence-here-h1 * prior-h1 / P_e) set prior-h2 (evidence-here-h2 * prior-h2 / P_e) if prior-h1 > 1 [set prior-h1 1] ; to avoid anomalous priors if prior-h2 > 1 [set prior-h2 1] ; to avoid anomalous priors ] ifelse (count-h1 + count-h2) > 0 [ ;ensures NetLogo will be able to calculate the fraction below set prop-h1 (count-h1 / (count-h1 + count-h2)) ; prop. h1 is the best set prop-h2 (count-h2 / (count-h1 + count-h2)) ; prop. h2 is the best set prop-h1 max list 0 min list 1 prop-h1 ; clamp values set prop-h2 max list 0 min list 1 prop-h2 ; clamp values ] [ set prop-h1 0 set prop-h2 0 ] ; truth-alignment procedure for power-seekers set preferred-hypothesis ifelse-value (EP_1 > EP_2) ["h1"] ["h2"] ;picks out the selected hypothesis ifelse preferred-hypothesis = current-truth [ set truth-hit? 1 ] [ set truth-hit? 0 ] ;; ---------- Truth scores for EP ---------- let w1 10 ^ EP_1 ;; for power‑seekers let w2 10 ^ EP_2 set p-h1 w1 / (w1 + w2) set p-h2 w2 / (w1 + w2) ifelse current-truth = "h1" [set brier (1 - p-h1) ^ 2] [set brier (1 - p-h2) ^ 2] ;set logscore - log (ifelse outcome = 1 [p-h1 10] [(1 - p-h1) 10]) ; ifelse preferred-hypothesis = current-truth [set truth-alignment truth-alignment + 1] [set truth-alignment truth-alignment - 1] ;truth alignment counting ; if truth-alignment > ticks [set truth-alignment ticks] ; clamp values ] if strategy = "goodness" [;goodness-seekers strategy let P_e (evidence-here-h1 * prior-h1 + evidence-here-h2 * prior-h2); computes P(e) using the rule of total probability ifelse prior-h1 < (10 ^ -300) [set k1 -300] [set k1 log prior-h1 10] ; k1 facilitates NetLogo's handling the log of very low numbers ifelse prior-h2 < (10 ^ -300) [set k2 -300] [set k2 log prior-h2 10]; k1 facilitates NetLogo's handling the log of very low numbers set EG_1 (log evidence-here-h1 10) - log P_e 10 + (0.5 * k1) ; explanatory goodness for h1 set EG_2 (log evidence-here-h2 10) - log P_e 10 + (0.5 * k2) ; explanatory goodness for h2 if EG_1 > EG_2 [set count-h1 count-h1 + 1] ;comparison procedure if EG_2 > EG_1 [set count-h2 count-h2 + 1] ;comparison procedure if g-s-bayes-updating? [ ;updating procedure set prior-h1 (evidence-here-h1 * prior-h1 / P_e) ; updating P(h1) set prior-h2 (evidence-here-h2 * prior-h2 / P_e) ; updating P(h2) if prior-h1 > 1 [set prior-h1 1] ; to avoid anomalous priors if prior-h2 > 1 [set prior-h2 1] ; to avoid anomalous priors ] ifelse (count-h1 + count-h2) > 0 [ ;ensures NetLogo will be able to calculate the fraction below set prop-h1 (count-h1 / (count-h1 + count-h2)) ; prop. h1 is the best set prop-h2 (count-h2 / (count-h1 + count-h2)) ; prop. h2 is the best set prop-h1 max list 0 min list 1 prop-h1 ; clamp values set prop-h2 max list 0 min list 1 prop-h2 ; clamp values ] [ set prop-h1 0 set prop-h2 0 ] ; truth-alignment procedure for goodness-seekers set preferred-hypothesis ifelse-value (EG_1 > EG_2) ["h1"] ["h2"] ;picks out the selected hypothesis ifelse preferred-hypothesis = current-truth [ set truth-hit? 1 ] [ set truth-hit? 0 ] ; ifelse preferred-hypothesis = current-truth [set truth-alignment truth-alignment + 1] [set truth-alignment truth-alignment - 1] ;truth alignment counting ; if truth-alignment > ticks [set truth-alignment ticks] ; clamp values ;; ---------- Truth scores for EG ---------- let w1 10 ^ EG_1 let w2 10 ^ EG_2 set p-h1 w1 / (w1 + w2) set p-h2 w2 / (w1 + w2) ifelse current-truth = "h1" [set brier (1 - p-h1) ^ 2] [set brier (1 - p-h2) ^ 2] ;set logscore - ln (if outcome = 1 [p-h1] [1 - p-h1]) ] end ;:::: HANNAH'S SUGGESTION TO ACCOUNT FOR JONAH'S CRITIQUE THAT I'M BEGGING THE QUESTION ::::::::::::: ; Use some prior (avg prior gs?) to set up the prop. of ticks h1 is true. ; For each tick, know whether T = h1 or T = h2. Then compute truth-alignment as the prop. of turtles which think the best explanation is T for each group. ;:::::::::::::::::::::::::::::PLOTS::::::::::::::::::::::::::::::::::: ; update plot for prop(h1) to update-plot set-current-plot "Brier over Time" set-current-plot-pen "Power-Seekers" plotxy ticks mean [prop-h1] of power-seekers set-current-plot-pen "Goodness-Seekers" plotxy ticks mean [prop-h1] of goodness-seekers end ; display results: average credence over time for both groups to plot-results set-current-plot "Brier over Time" set-current-plot-pen "Power-Seekers" plotxy ticks mean [brier] of power-seekers set-current-plot-pen "Goodness-Seekers" plotxy ticks mean [brier] of goodness-seekers end to update-truth-alignment-plot set-current-plot "Truth Hit (per tick)" set-current-plot-pen "Power-Seekers" plotxy ticks mean [truth-hit?] of power-seekers set-current-plot-pen "Goodness-Seekers" plotxy ticks mean [truth-hit?] of goodness-seekers end ; display results: truth alignment over time for both groups to plot-results1 set-current-plot "Truth Hit (per tick)" set-current-plot-pen "Power-Seekers" plotxy ticks mean [truth-hit?] of power-seekers set-current-plot-pen "Goodness-Seekers" plotxy ticks mean [truth-hit?] of goodness-seekers end ; update priors distribution histogram to update-histogram set-current-plot "Prior Distributions" clear-plot set-current-plot-pen "Distribution h1 PS" histogram [prior-h1] of power-seekers set-current-plot-pen "Distribution h1 GS" histogram [prior-h1] of goodness-seekers end ; update disagreement plot to update-disagreement-plot set-current-plot "Disagreement on the BE over Time" set-current-plot-pen "Power-Seekers" plotxy ticks standard-deviation [prop-h1] of power-seekers set-current-plot-pen "Goodness-Seekers" plotxy ticks standard-deviation [prop-h1] of goodness-seekers end ;to update-truth-alignment-plot ; set-current-plot "Truth Alignment (per tick)" ; set-current-plot-pen "Power-Seekers" ; plotxy ticks alignment-of power-seekers ; set-current-plot-pen "Goodness-Seekers" ; plotxy ticks alignment-of goodness-seekers ;end ;##################################################################################################
There is only one version of this model, created 1 day ago by Gesiel da Silva.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
Download this model