Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Learning Agent-Based Models from Data

Learning Agent-Based Models from Data

More Decks by Gianmarco De Francisci Morales

Other Decks in Research

Transcript

  1. Learning Agent-Based Models from Data Gianmarco De Francisci Morales Principal

    Researcher • CENTAI Team Lead • Social Algorithmics Team 
 [email protected] 1 SALT
  2. Learning Agent-Based Models from Data Models Gianmarco De Francisci Morales

    Principal Researcher • CENTAI Team Lead • Social Algorithmics Team 
 [email protected] 1 SALT
  3. 2

  4. 2

  5. Agent-based model Evolution over time of system of autonomous agents

    Agents interact according to prede fi ned rules Encode sociological assumptions 3
  6. Agent-based model Evolution over time of system of autonomous agents

    Agents interact according to prede fi ned rules Encode sociological assumptions System is simulated to draw conclusions 3
  7. Example: Schelling's segregation 2 types of agents: R and B

    Satisfaction: number of neighbors of same color Homophily parameter If τ Si < τ → relocate 4
  8. Example: Schelling's segregation 2 types of agents: R and B

    Satisfaction: number of neighbors of same color Homophily parameter If τ Si < τ → relocate 4
  9. Are ABMs scienti fi c models? Mechanistic models Explainable and

    causal by construction Counterfactual level of ladder of causality 5 𝔼 (Y ∣ X) 𝔼 (Y ∣ do(X)) 𝔼 (YX′  ∣ X, YX )
  10. Are ABMs scienti fi c models? Mechanistic models Explainable and

    causal by construction Counterfactual level of ladder of causality Data not a fi rst-class citizen No sound parameter- fi tting procedure 5
  11. ABMs and Data ABM born as "theory development tool" Simulations

    generate implications of encoded assumptions 7
  12. ABMs and Data ABM born as "theory development tool" Simulations

    generate implications of encoded assumptions Now people use it as forecasting tool (epidemiology, economics, etc.) 7
  13. ABMs and Data ABM born as "theory development tool" Simulations

    generate implications of encoded assumptions Now people use it as forecasting tool (epidemiology, economics, etc.) Calibration to set parameters from data 7
  14. Calibration Run simulations with different parameters until model reproduces 


    summary statistics of data No parameter signi fi cance or model selection 8
  15. Calibration Run simulations with different parameters until model reproduces 


    summary statistics of data No parameter signi fi cance or model selection Arbitrary choice of summary statistics and distance measure 8
  16. Calibration Run simulations with different parameters until model reproduces 


    summary statistics of data No parameter signi fi cance or model selection Arbitrary choice of summary statistics and distance measure Manual, expensive, and error-prone process 8
  17. Can we do better? Yes! Rewrite ABM as Probabilistic Generative

    Model 
 Xt ∼ Pt (Xt ∣ Θ, Xτ<t ) 9
  18. Can we do better? Yes! Rewrite ABM as Probabilistic Generative

    Model 
 Xt ∼ Pt (Xt ∣ Θ, Xτ<t ) Write likelihood of parameters given data 
 ℒ(Θ ∣ X) = PΘ (X ∣ Θ) 9
  19. Can we do better? Yes! Rewrite ABM as Probabilistic Generative

    Model 
 Xt ∼ Pt (Xt ∣ Θ, Xτ<t ) Write likelihood of parameters given data 
 ℒ(Θ ∣ X) = PΘ (X ∣ Θ) Maximize via Auto Differentiation ̂ Θ = arg max Θ ℒ(Θ ∣ X) 9
  20. Historical Aside Maximum Likelihood Estimation invented by Fisher Dates back

    to Daniel Bernoulli and Lagrange in the eighteenth century Fisher introduced the method as alternative to method of moments Which he criticizes for its arbitrariness in the choice of moment equations 10
  21. Autodiff Set of techniques to evaluate the partial derivative of

    a computer program Chain rule to break complex expressions Originally created for neural networks and deep learning (backpropagation) Different from numerical and symbolic differentiation ∂f(g(x)) ∂x = ∂f ∂g ∂g ∂x 11
  22. Example Automatic Differentiation (autodiff) • Create computation graph for gradient

    computation ∗ "# + %# ∗ "& %& "' + ∗ −1 *%+ +1 , = 1 1 + *.(012034320545) 1/% 12
  23. Example Automatic Differentiation (autodiff) • Create computation graph for gradient

    computation ∗ "# + %# ∗ "& %& "' + ∗ −1 *%+ +1 1/% − 1 %& - = 1 1 + */(123145431656) - % = 1/% à 89 85 = −1/%& 13
  24. Example Automatic Differentiation (autodiff) • Create computation graph for gradient

    computation ∗ "# + %# ∗ "& %& "' + ∗ −1 *%+ +1 1/% − 1 %& - = 1 1 + */(123145431656) ∗ 1 - % = % + 1 à 89 85 = 1 14
  25. Example Automatic Differentiation (autodiff) • Create computation graph for gradient

    computation ∗ "# + %# ∗ "& %& "' + ∗ −1 *%+ +1 1/% − 1 %& - = 1 1 + */(123145431656) ∗ 1 ∗ - % = *5 à 89 85 = *5 15
  26. Example Automatic Differentiation (autodiff) • Create computation graph for gradient

    computation ∗ "# + %# ∗ "& %& "' + ∗ −1 *%+ +1 1/% − 1 %& - = 1 1 + */(123145431656) ∗ 1 ∗ ∗ −1 ∗ 89 814 - %, " = %" à 8; 81 = % 16
  27. Example Automatic Differentiation (autodiff) • Create computation graph for gradient

    computation ∗ "# + %# ∗ "& %& "' + ∗ −1 *%+ +1 1/% − 1 %& - = 1 1 + */(123145431656) ∗ 1 ∗ ∗ −1 ∗ 89 814 ∗ 89 816 17
  28. Problem Solution → No parameter signi fi cance or model

    selection Probabilistic modeling 
 18 →
  29. Problem Solution → No parameter signi fi cance or model

    selection Arbitrary choice of summary statistics and distance measure Probabilistic modeling 
 Data likelihood 
 18 → →
  30. Problem Solution → No parameter signi fi cance or model

    selection Arbitrary choice of summary statistics and distance measure Manual, expensive, and 
 error-prone process Probabilistic modeling 
 Data likelihood 
 Automatic differentiation 18 → → →
  31. Likelihood-Based Methods Improve Parameter Estimation in Opinion D XC X0

    XC+1 B 4 n ) (a) BCM-F X: opinions s: interaction outcome e: interacting agents : bounded con fi dence interval ϵ Generative Model 21
  32. 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 0 1000

    k=1 0 1000 k=2 Number of agents Mt 0 100 k=0 0 100 k=1 100 k er of buyers DB t Learned trace Ground truth Latent Observable 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 0 1000 k=1 0 1000 k=2 Number of agents Mt 0 100 k=0 0 100 k=1 100 k= ber of buyers DB t Learned trace Ground truth 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 1000 k=1 f agents Mt Learned trace Ground truth Micro-State Inference
  33. 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 0 1000

    k=1 0 1000 k=2 Number of agents Mt 0 100 k=0 0 100 k=1 100 k er of buyers DB t Learned trace Ground truth Latent Observable 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 0 1000 k=1 0 1000 k=2 Number of agents Mt 0 100 k=0 0 100 k=1 100 k= ber of buyers DB t Learned trace Ground truth 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 1000 k=1 f agents Mt Learned trace Ground truth Micro-State Inference
  34. 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 0 1000

    k=1 0 1000 k=2 Number of agents Mt 0 100 k=0 0 100 k=1 100 k er of buyers DB t Learned trace Ground truth Latent Observable 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 0 1000 k=1 0 1000 k=2 Number of agents Mt 0 100 k=0 0 100 k=1 100 k= ber of buyers DB t Learned trace Ground truth 0 1000 x=0 x=1 x=2 x=3 k=0 x=4 1000 k=1 f agents Mt Learned trace Ground truth Micro-State Inference
  35. 2 0 2 n+ = 0.4 n = 0.6 0

    2 n+ = 1.2 n = 1.6 nthetic data traces generated in each scenario. Plots represent the opini Opinion Trajectories Parameter values encode different assumptions and 
 determine signi fi cantly different latent trajectories 29
  36. Recovering parameters 31 Figure 4: Examples of synthetic data traces

    generated in each s 0 2 n+ = 0.6 n = 1.2 0 2 n+ = 0.4 n = 0.6 0 2 n+ = 1.2 n = 1.6 0 2 n+ = 0.2 n = 1.6 Figure 4: Examples of synthetic data traces generated in each scenario. Plots represent the opinion trajectories along time.
  37. Real data: Number of upvotes on comments Estimate position of

    users and subreddits in opinion space 32
  38. Real data: Number of upvotes on comments Estimate position of

    users and subreddits in opinion space Larger estimated distance of user from subreddit fewer upvotes of user on that subreddit → 32
  39. Likelihoods are hard Writing the correct complete data likelihood can

    be challenging Easy to make mistakes Requires deep understanding of the data generating process 34
  40. Likelihoods are hard Writing the correct complete data likelihood can

    be challenging Easy to make mistakes Requires deep understanding of the data generating process Is there a way to avoid it? Variational approximation! 34
  41. Variational Inference Bayesian technique to approximate intractable probability integrals Alternative

    to Monte Carlo sampling (e.g., MCMC, Gibbs sampling) approximation of the posterior = variational distribution, tractable parametric family Variational parameters optimized by minimizing the KL divergence between and P(Θ ∣ X) ≈ Qϕ (Θ) Qϕ ϕ P Q 35
  42. Variational Inference Bayesian technique to approximate intractable probability integrals Alternative

    to Monte Carlo sampling (e.g., MCMC, Gibbs sampling) approximation of the posterior = variational distribution, tractable parametric family Variational parameters optimized by minimizing the KL divergence between and P(Θ ∣ X) ≈ Qϕ (Θ) Qϕ ϕ P Q Transforms inference into an optimization problem 35
  43. No Need to Write Likelihood 36 P( ∣ ) Original

    ABM Probabilistic Generative ABM Variational Inference Data Approximate posterior macro- and micro-parameters ˜ P(ε ∣ ) ˜ P(r 1 , …, r N ∣ ) t t+1 t+1 t
  44. Model Thinking Always think about the Data-Generating Process Model- fi

    rst thinking as justi fi cation for scienti fi c claims 40
  45. Model Thinking Always think about the Data-Generating Process Model- fi

    rst thinking as justi fi cation for scienti fi c claims Causal (possibly mechanistic) models (e.g., ABMs) 40
  46. Model Thinking Always think about the Data-Generating Process Model- fi

    rst thinking as justi fi cation for scienti fi c claims Causal (possibly mechanistic) models (e.g., ABMs) Use scienti fi cally signi fi cant models 40
  47. Conclusions Fit ABMs as statistical models Rewrite as probabilistic models

    for the data-generating process Learn latent variables of models Forecasting and predictions Model selection 41
  48. Conclusions Fit ABMs as statistical models Rewrite as probabilistic models

    for the data-generating process Learn latent variables of models Forecasting and predictions Model selection Use data to fi gure out which models work (Ptolemy vs Kepler) Bring ABM in line with statistical models (and scienti fi c ones) 41
  49. C. Monti, G. De Francisci Morales, F. Bonchi 
 “Learning

    Opinion Dynamics From Social Traces” 
 KDD 2020 C. Monti, M. Pangallo, G. De Francisci Morales, F. Bonchi 
 “On Learning Agent-Based Models from Data” 
 Scienti fi c Reports 2023 J. Lenti, C. Monti, G. De Francisci Morales 
 “Likelihood-Based Methods Improve Parameter Estimation in Opinion Dynamics Models” 
 WSDM 2024 J. Lenti, F. Silvestri, G. De Francisci Morales 
 “Variational Inference of Parameters in Opinion Dynamics Models” 
 arXiv:2403.05358 2024 42 [email protected] https://gdfm.me @gdfm7