Tools: computational analysis

Networks, machine learning, embeddings, and simulation

The maintained version of Chapter 8’s tool list: networks, machine learning, embeddings, and simulation.

Use these tools to implement the network, prediction, and simulation exercises in Chapter 8. Choose a method from your research question, then check whether the tool supports the assumptions and diagnostics you need. Tool selection reviewed August 2026.

Network analysis

  • NetworkX (Python): graph construction, measures, and algorithms; used in the worked network notebook.
  • igraph (C, Python, R): graph analysis with a compiled core and interfaces in several languages.
  • statnet (R): ERGMs and statistical models of tie formation, for explanatory work on network structure.
  • graph-tool (Python): graph analysis with a compiled core; check its installation requirements.

Visualization: Gephi for interactive network layouts, Cytoscape for attribute-rich networks. Always report the layout algorithm and its parameters (Chapter 9, §9.4.5).

Machine learning

  • scikit-learn: classifiers, preprocessing, model selection, and evaluation metrics.
  • XGBoost and LightGBM: gradient boosting for tasks such as prediction from tabular data. Compare performance with a simpler baseline on held-out observations.
  • SHAP: feature attributions, global and per-prediction. Remember Chapter 7’s caution: an explanation of a prediction is not a causal claim.

Embeddings

  • gensim: Word2Vec and related vector models.
  • Sentence-Transformers: embeddings for sentences and other text units.
  • UMAP: projection for visualization. Report the algorithm, its parameters, and the output dimensionality; Chapter 9 (§9.4.5) shows how much the picture changes without them.

Simulation

  • Mesa (Python): agent-based modeling framework.
  • NetLogo: a modeling environment for exploring how agent-level rules produce aggregate patterns.

Causal inference with machine learning

  • DoWhy and EconML (Python): identification and heterogeneous treatment effects.
  • grf (R): causal forests.

Reproducibility

Set and record random seeds, and compare results across seeds when variation matters to your conclusion. Record dependencies with a lock file (Chapter 9, §9.3.2). See communication tools for environment management.