Skip to main content

mossspider

tests version docs Downloads

MossSpider

MossSpider provides an implementation of the targeted maximum likelihood estimator for network-dependent data (network-TMLE) in Python. Currently mossspider supports estimation of the conditional network mean for stochastic policies.

mossspider get its name from the spruce-fir moss spider, a tarantula that is both the world's smallest tarantula and native to North Carolina.

Installation

Installing:

You can install via python -m pip install mossspider

Dependencies:

The dependencies are: numpy, scipy, statsmodels, networkx, matplotlib. Notice that NetworkX must be at least 2.0.0 to work properly.

Getting started

To demonstrate mossspider, below is a simple demonstration of calculating the mean for the following data.

from mossspider import NetworkTMLE
from mossspider.dgm import uniform_network, generate_observed

First, we will use some built-in data generating functions

graph = uniform_network(n=500, degree=[1, 4])
graph_observed = generate_observed(graph)

Now, we can use NetworkTMLE to estimate the causal conditional mean under a stochastic policy. Here, the stochastic policy sets everyone's probability of action A=1 to 0.65.

ntmle = NetworkTMLE(network=graph_observed,
                    exposure='A',  # Exposure in graph
                    outcome='Y',   # Outcome in graph
                    verbose=True)  # Print model summaries
ntmle.exposure_model(model="W + W_sum")
ntmle.exposure_map_model(model='A + W + W_sum',  # Parametric model
                         measure='sum',          # Summary measure for A^s
                         distribution='poisson') # Model distribution to use
ntmle.outcome_model(model='A + A_sum + W + W_sum')
ntmle.fit(p=0.65, samples=500)
ntmle.summary()

For full details on using mossspider, see the full documentation and worked examples available at MossSpider website.

Metadata

Release files for mossspider 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mossspider 0.0.3
File Size Uploaded
mossspider-0.0.3.tar.gz 26.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mossspider 0.0.3
File Interpreter ABI Platform
mossspider-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 55.3 kB

Release files / mossspider-0.0.3.tar.gz

Download URL mossspider-0.0.3.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6c538d4780f6ae2d07e92da4b0a599465329b64f0b677082631356c998736696
BLAKE2b-256 checksum
How to use checksums
9f4342bbb12a4843e8052424e216a2aa93636a202fc6e8df59daee92cde74136
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.5

Release files / mossspider-0.0.3-py3-none-any.whl

Download URL mossspider-0.0.3-py3-none-any.whl
Size 29.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d1dfb03e97d5feb274ec72d597449b72acde82ce9305902b7b2138ca7cb6a60
BLAKE2b-256 checksum
How to use checksums
d361c5b63d292358a1fe669712286a4716c4d3fba64ee006832c9b52674f6283
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page