Troubleshooting

Installed versions

Most installation problems come down to a mismatch between the interpreter that installed the packages and the interpreter that is importing them, which these four lines will show.

import sys
from importlib.metadata import version

print("python    ", sys.version.split()[0])
print("executable", sys.executable)
print("estimint  ", version("estimint"))
print("mintstate ", version("mintstate"))
python     3.12.11
executable /home/cosmo/Documents/Repos/MINTverse/.venv/bin/python
estimint   1.5.4
mintstate  0.3.1

In a notebook sys.executable belongs to the kernel rather than to whatever the terminal has activated. If it is not the environment you installed into, the kernel is the problem and the packages are fine.

Installation and imports

ModuleNotFoundError: No module named 'stateMINT'

ModuleNotFoundError: No module named 'stateMINT'

There are two causes. The first is that estiMINT was installed without the emulator, since plain pip install estimint gives you the EIR and HBR models and nothing else. The scenarios extra pulls the emulator in.

pip install "estimint[scenarios]"

The second cause is that the interpreter running your code is not the interpreter you installed into, which is the usual explanation when the install succeeded and the import still fails. Please see Environments and packages and Notebooks.

No distribution named statemint

ERROR: Could not find a version that satisfies the requirement statemint
ERROR: No matching distribution found for statemint

The distribution is called mintstate and the module it installs is called stateMINT. The capitals matter to the import.

pip install mintstate            # the emulator on its own
pip install "estimint[scenarios]"  # both packages, what you normally want

An interpreter older than 3.12

Both packages require Python 3.12 or newer. On an older interpreter pip either refuses to install or resolves to an earlier release that predates the requirement.

python --version

If that prints 3.11 or below, build a new environment on 3.12 rather than upgrading in place. Please see Installing Python.

Inputs the models reject

ValueError: unknown net type

ValueError: unknown net type: 'pyrethroid-pbo' (have ['py_only', 'py_pbo', 'py_ppf',
'py_pyrrole', 'pyrethroid_only', 'pyrethroid_pbo', 'pyrethroid_ppf', 'pyrethroid_pyrrole'])

The net types are Python identifiers, so a name written with a hyphen where the accepted strings carry _ is rejected. The message lists the eight strings that work, four full names and four short aliases.

ValueError: Missing static covariates

ValueError: Missing static covariates: ['lsm']

All twelve static covariates are mandatory and none has a default. Passing lsm=0.0 means no larviciding, while omitting lsm means an incomplete input. The twelve, in order, are eir, dn0_use, dn0_future, Q0, phi_bednets, seasonal, routine, itn_use, irs_use, itn_future, irs_future and lsm. Covariates and the time grid takes them one at a time.

ValueError: Missing required columns

ValueError: Missing required columns: irs_use, itn_use, phi_bednets, prev_y9, seasonal

run_xgb_model raises this when the DataFrame lacks a column the model was trained on. Each model carries its own feature list, readable off the loaded model.

from estimint import load_xgb_model

print(load_xgb_model("prevalence")["features"])
['dn0_use', 'Q0', 'phi_bednets', 'seasonal', 'itn_use', 'irs_use', 'prev_y9']

The prevalence column must be named prev_y9, with prevalence accepted as an alias and nothing else.

A slow first run

The XGBoost models ship inside the estiMINT wheel and load instantly. The emulator weights live on the Hugging Face Hub at dide-ic/stateMINT and are fetched on first use, roughly 38 MB per predictor. They then sit under ~/.cache/huggingface and are never fetched again.

Pay the download up front if the wait is inconvenient.

from estimint import preload_models

preload_models()
({'prevalence': {'class': 'estiMINT_model',
   'booster': <xgboost.core.Booster at 0x7fa558190680>,
   'calibrator': {'kind': 'qmap+scale',
    'qmap': {'xq': array([4.92082924e-01, 5.08736263e-01, 5.15917185e-01, ...,
            4.91688733e+02, 4.97695909e+02, 5.53270569e+02], shape=(1024,)),
     'yq': array([  0.50277175,   0.50826802,   0.51678258, ..., 492.46471518,
            497.17948618, 498.76760326], shape=(1024,))},
    'scale': np.float64(1.0004966152605534)},
   'features': ['dn0_use',
    'Q0',
    'phi_bednets',
    'seasonal',
    'itn_use',
    'irs_use',
    'prev_y9'],
   'best_nrounds': 3382,
   'preprocess': {'features': ['dn0_use',
     'Q0',
     'phi_bednets',
     'seasonal',
     'itn_use',
     'irs_use',
     'prev_y9'],
    'target': 'eir',
    'transform': 'log10',
    'inverse': 'pow10',
    'prevalence_filter': {'min_prev_input': 0.02,
     'note': 'Trained on MINTelligence data with prev >= 0.02'},
    'training_data': {'source': 'MINTelligence malaria_simulations_4096.duckdb',
     'n_rows': 12429,
     'n_params': 3122},
    'cv': {'K': 10,
     'stratify_by': 'strat_bin (k-means on log10(EIR), centers=16)',
     'best_iteration_median': 3382}}},
  'hbr': {'class': 'estiMINT_HBR_model',
   'booster': <xgboost.core.Booster at 0x7fa49f249940>,
   'calibrator': {'kind': 'qmap+scale',
    'qmap': {'xq': array([5.08448929e-02, 7.88109408e-02, 9.63397659e-02, ...,
            4.85768127e+02, 4.90127920e+02, 5.07243958e+02], shape=(1024,)),
     'yq': array([  0.50124624,   0.50277381,   0.50468261, ..., 490.64325984,
            496.71453703, 498.76760326], shape=(1024,))},
    'scale': np.float64(0.998817814339553)},
   'features': ['dn0_use',
    'Q0',
    'phi_bednets',
    'seasonal',
    'itn_use',
    'irs_use',
    'hbr_y9'],
   'best_nrounds': 2056,
   'preprocess': {'features': ['dn0_use',
     'Q0',
     'phi_bednets',
     'seasonal',
     'itn_use',
     'irs_use',
     'hbr_y9'],
    'target': 'eir',
    'transform': 'log10',
    'inverse': 'pow10',
    'hbr_filter': {'note': 'Trained on MINTelligence data, HBR > 0 (Im > 0)'},
    'training_data': {'source': 'MINTelligence HBR_malaria_simulations_4096.duckdb',
     'n_rows': 16384,
     'n_params': 4096},
    'cv': {'K': 10,
     'stratify_by': 'strat_bin (k-means on log10(EIR), centers=16)',
     'best_iteration_median': 2056}}},
  'eir_to_hbr': {'class': 'estiMINT_EIR_to_HBR_model',
   'booster': <xgboost.core.Booster at 0x7fa49f249e20>,
   'calibrator': {'kind': 'qmap+scale',
    'qmap': {'xq': array([   17239.49609375,    18828.35925758,    18899.65238671, ...,
            10785096.00879765, 10940766.        , 11249918.        ],
           shape=(1024,)),
     'yq': array([   17226.44209519,    18794.25603442,    18866.22134417, ...,
            10776298.1685966 , 10940210.52983362, 11259525.78602804],
           shape=(1024,))},
    'scale': np.float64(1.000678262727661)},
   'features': ['eir',
    'dn0_use',
    'Q0',
    'phi_bednets',
    'seasonal',
    'itn_use',
    'irs_use'],
   'best_nrounds': 4566,
   'preprocess': {'features': ['eir',
     'dn0_use',
     'Q0',
     'phi_bednets',
     'seasonal',
     'itn_use',
     'irs_use'],
    'target': 'hbr_y9',
    'transform': 'log10',
    'inverse': 'pow10',
    'training_data': {'source': 'MINTelligence malaria_simulations_4096.duckdb + HBR_malaria_simulations_4096.duckdb',
     'n_rows': 12429,
     'n_params': 3122},
    'cv': {'K': 10,
     'stratify_by': 'strat_bin (k-means on log10(HBR), centers=16)',
     'best_iteration_median': 4566}}}},
 {'prevalence': ModelArtifact(model=Mamba2Regressor( # RngState: 2 (12 B), Param: 935,985 (3.7 MB), Total: 935,987 (3.7 MB)
    input_proj=Linear( # Param: 4,352 (17.4 KB)
      kernel=Param( # 4,096 (16.4 KB)
        value=Array(shape=(16, 256), dtype=dtype('float32'))
      ),
      bias=Param( # 256 (1.0 KB)
        value=Array(shape=(256,), dtype=dtype('float32'))
      ),
      in_features=16,
      out_features=256,
      use_bias=True,
      dtype=None,
      param_dtype=float32,
      precision=None,
      dot_general=<function dot_general at 0x7fa49e4d1440>,
      promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
      preferred_element_type=None
    ),
    mamba2=Mamba2Model( # Param: 931,376 (3.7 MB)
      cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
      embedder=Embed( # Param: 256 (1.0 KB)
        embedding=Param( # 256 (1.0 KB)
          value=Array(shape=(1, 256), dtype=dtype('float32'))
        ),
        num_embeddings=1,
        features=256,
        dtype=dtype('float32'),
        param_dtype=float32,
        promote_dtype=<function promote_dtype at 0x7fa488f76f20>
      ),
      layers=List([
        Mamba2Block( # Param: 465,432 (1.9 MB)
          cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
          residual_in_fp32=True,
          norm=RMSNorm( # Param: 256 (1.0 KB)
            hidden_size=256,
            eps=1e-05,
            gate_residual=False,
            weight=Param( # 256 (1.0 KB)
              value=Array(shape=(256,), dtype=dtype('float32'))
            )
          ),
          mixer=Mamba2Mixer( # Param: 465,176 (1.9 MB)
            cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
            layer_idx=0,
            hidden_size=256,
            ssm_state_size=128,
            intermediate_size=512,
            head_dim=64,
            num_heads=8,
            chunk_size=256,
            dt_min=0.0,
            dt_max=inf,
            act=<PjitFunction of <function silu at 0x7fa49dd3b7e0>>,
            in_proj=Linear( # Param: 329,728 (1.3 MB)
              kernel=Param( # 329,728 (1.3 MB)
                value=Array(shape=(256, 1288), dtype=dtype('float32'))
              ),
              bias=None,
              in_features=256,
              out_features=1288,
              use_bias=False,
              dtype=None,
              param_dtype=float32,
              precision=None,
              dot_general=<function dot_general at 0x7fa49e4d1440>,
              promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
              preferred_element_type=None
            ),
            conv1d=DepthwiseConv1d( # Param: 3,840 (15.4 KB)
              features=768,
              kernel_size=4,
              conv=Conv( # Param: 3,840 (15.4 KB)
                kernel_shape=(4, 1, 768),
                kernel=Param( # 3,072 (12.3 KB)
                  value=Array(shape=(4, 1, 768), dtype=dtype('float32'))
                ),
                bias=Param( # 768 (3.1 KB)
                  value=Array(shape=(768,), dtype=dtype('float32'))
                ),
                in_features=768,
                out_features=768,
                kernel_size=(4,),
                strides=1,
                padding=((0, 0),),
                input_dilation=1,
                kernel_dilation=1,
                feature_group_count=768,
                use_bias=True,
                mask=None,
                dtype=None,
                param_dtype=float32,
                precision=None,
                conv_general_dilated=<function conv_general_dilated at 0x7fa49e37c680>,
                promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
                preferred_element_type=None
              )
            ),
            dt_bias=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            A_log=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            D=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            norm=RMSNorm( # Param: 512 (2.0 KB)
              hidden_size=512,
              eps=1e-05,
              gate_residual=True,
              weight=Param( # 512 (2.0 KB)
                value=Array(shape=(512,), dtype=dtype('float32'))
              )
            ),
            out_proj=Linear( # Param: 131,072 (524.3 KB)
              kernel=Param( # 131,072 (524.3 KB)
                value=Array(shape=(512, 256), dtype=dtype('float32'))
              ),
              bias=None,
              in_features=512,
              out_features=256,
              use_bias=False,
              dtype=None,
              param_dtype=float32,
              precision=None,
              dot_general=<function dot_general at 0x7fa49e4d1440>,
              promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
              preferred_element_type=None
            )
          )
        ),
        Mamba2Block( # Param: 465,432 (1.9 MB)
          cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
          residual_in_fp32=True,
          norm=RMSNorm( # Param: 256 (1.0 KB)
            hidden_size=256,
            eps=1e-05,
            gate_residual=False,
            weight=Param( # 256 (1.0 KB)
              value=Array(shape=(256,), dtype=dtype('float32'))
            )
          ),
          mixer=Mamba2Mixer( # Param: 465,176 (1.9 MB)
            cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
            layer_idx=1,
            hidden_size=256,
            ssm_state_size=128,
            intermediate_size=512,
            head_dim=64,
            num_heads=8,
            chunk_size=256,
            dt_min=0.0,
            dt_max=inf,
            act=<PjitFunction of <function silu at 0x7fa49dd3b7e0>>,
            in_proj=Linear( # Param: 329,728 (1.3 MB)
              kernel=Param( # 329,728 (1.3 MB)
                value=Array(shape=(256, 1288), dtype=dtype('float32'))
              ),
              bias=None,
              in_features=256,
              out_features=1288,
              use_bias=False,
              dtype=None,
              param_dtype=float32,
              precision=None,
              dot_general=<function dot_general at 0x7fa49e4d1440>,
              promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
              preferred_element_type=None
            ),
            conv1d=DepthwiseConv1d( # Param: 3,840 (15.4 KB)
              features=768,
              kernel_size=4,
              conv=Conv( # Param: 3,840 (15.4 KB)
                kernel_shape=(4, 1, 768),
                kernel=Param( # 3,072 (12.3 KB)
                  value=Array(shape=(4, 1, 768), dtype=dtype('float32'))
                ),
                bias=Param( # 768 (3.1 KB)
                  value=Array(shape=(768,), dtype=dtype('float32'))
                ),
                in_features=768,
                out_features=768,
                kernel_size=(4,),
                strides=1,
                padding=((0, 0),),
                input_dilation=1,
                kernel_dilation=1,
                feature_group_count=768,
                use_bias=True,
                mask=None,
                dtype=None,
                param_dtype=float32,
                precision=None,
                conv_general_dilated=<function conv_general_dilated at 0x7fa49e37c680>,
                promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
                preferred_element_type=None
              )
            ),
            dt_bias=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            A_log=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            D=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            norm=RMSNorm( # Param: 512 (2.0 KB)
              hidden_size=512,
              eps=1e-05,
              gate_residual=True,
              weight=Param( # 512 (2.0 KB)
                value=Array(shape=(512,), dtype=dtype('float32'))
              )
            ),
            out_proj=Linear( # Param: 131,072 (524.3 KB)
              kernel=Param( # 131,072 (524.3 KB)
                value=Array(shape=(512, 256), dtype=dtype('float32'))
              ),
              bias=None,
              in_features=512,
              out_features=256,
              use_bias=False,
              dtype=None,
              param_dtype=float32,
              precision=None,
              dot_general=<function dot_general at 0x7fa49e4d1440>,
              promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
              preferred_element_type=None
            )
          )
        )
      ]),
      final_norm=RMSNorm( # Param: 256 (1.0 KB)
        hidden_size=256,
        eps=1e-05,
        gate_residual=False,
        weight=Param( # 256 (1.0 KB)
          value=Array(shape=(256,), dtype=dtype('float32'))
        )
      )
    ),
    dropout=Dropout( # RngState: 2 (12 B)
      rate=0.24,
      broadcast_dims=(),
      deterministic=True,
      rng_collection='dropout',
      rngs=RngStream( # RngState: 2 (12 B)
        tag='default',
        key=RngKey( # 1 (8 B)
          value=Array((), dtype=key<fry>) overlaying:
          [ 991576401 3935454969],
          tag='default'
        ),
        count=RngCount( # 1 (4 B)
          value=Array(19099, dtype=uint32),
          tag='default'
        )
      )
    ),
    output_proj=Linear( # Param: 257 (1.0 KB)
      kernel=Param( # 256 (1.0 KB)
        value=Array(shape=(256, 1), dtype=dtype('float32'))
      ),
      bias=Param( # 1 (4 B)
        value=Array([-0.11879815], dtype=float32)
      ),
      in_features=256,
      out_features=1,
      use_bias=True,
      dtype=None,
      param_dtype=float32,
      precision=None,
      dot_general=<function dot_general at 0x7fa49e4d1440>,
      promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
      preferred_element_type=None
    )
  ), model_config={'model_type': 'Mamba2Regressor', 'predictor': 'prevalence', 'input_size': 16, 'd_model': 256, 'n_layers': 2, 'd_state': 128, 'd_conv': 4, 'expand': 2, 'head_dim': 64, 'chunk_size': 256, 'output_dim': 1, 'dropout': 0.24}, preprocessing_config={'static_covars': ['eir', 'dn0_use', 'dn0_future', 'Q0', 'phi_bednets', 'seasonal', 'routine', 'itn_use', 'irs_use', 'itn_future', 'irs_future', 'lsm'], 'after_intervention': ['dn0_future', 'itn_future', 'irs_future', 'lsm', 'routine'], 'intervention_day': 3285, 'n_steps': 157, 'model_start_day': 2190, 'window_size': 14, 'use_cyclical_time': True, 'predictor': 'prevalence', 'eps_prevalence': 1e-05, 'scaler_mean': [58.74008560180664, 0.31604108214378357, 0.3175233006477356, 0.7978994250297546, 0.6636720895767212, 0.482501357793808, 0.48787713050842285, 0.25194787979125977, 0.15634511411190033, 0.25312861800193787, 0.17558598518371582, 0.24548254907131195], 'scaler_scale': [104.59117126464844, 0.16008581221103668, 0.15946531295776367, 0.11743186414241791, 0.16026772558689117, 0.49969369173049927, 0.4998529851436615, 0.32460200786590576, 0.26269596815109253, 0.32312172651290894, 0.2886512279510498, 0.32189667224884033]}, scaler=<stateMINT.data.features.StandardScaler object at 0x7fa46c6d9190>),
  'cases': ModelArtifact(model=Mamba2Regressor( # RngState: 2 (12 B), Param: 935,985 (3.7 MB), Total: 935,987 (3.7 MB)
    input_proj=Linear( # Param: 4,352 (17.4 KB)
      kernel=Param( # 4,096 (16.4 KB)
        value=Array(shape=(16, 256), dtype=dtype('float32'))
      ),
      bias=Param( # 256 (1.0 KB)
        value=Array(shape=(256,), dtype=dtype('float32'))
      ),
      in_features=16,
      out_features=256,
      use_bias=True,
      dtype=None,
      param_dtype=float32,
      precision=None,
      dot_general=<function dot_general at 0x7fa49e4d1440>,
      promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
      preferred_element_type=None
    ),
    mamba2=Mamba2Model( # Param: 931,376 (3.7 MB)
      cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
      embedder=Embed( # Param: 256 (1.0 KB)
        embedding=Param( # 256 (1.0 KB)
          value=Array(shape=(1, 256), dtype=dtype('float32'))
        ),
        num_embeddings=1,
        features=256,
        dtype=dtype('float32'),
        param_dtype=float32,
        promote_dtype=<function promote_dtype at 0x7fa488f76f20>
      ),
      layers=List([
        Mamba2Block( # Param: 465,432 (1.9 MB)
          cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
          residual_in_fp32=True,
          norm=RMSNorm( # Param: 256 (1.0 KB)
            hidden_size=256,
            eps=1e-05,
            gate_residual=False,
            weight=Param( # 256 (1.0 KB)
              value=Array(shape=(256,), dtype=dtype('float32'))
            )
          ),
          mixer=Mamba2Mixer( # Param: 465,176 (1.9 MB)
            cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
            layer_idx=0,
            hidden_size=256,
            ssm_state_size=128,
            intermediate_size=512,
            head_dim=64,
            num_heads=8,
            chunk_size=256,
            dt_min=0.0,
            dt_max=inf,
            act=<PjitFunction of <function silu at 0x7fa49dd3b7e0>>,
            in_proj=Linear( # Param: 329,728 (1.3 MB)
              kernel=Param( # 329,728 (1.3 MB)
                value=Array(shape=(256, 1288), dtype=dtype('float32'))
              ),
              bias=None,
              in_features=256,
              out_features=1288,
              use_bias=False,
              dtype=None,
              param_dtype=float32,
              precision=None,
              dot_general=<function dot_general at 0x7fa49e4d1440>,
              promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
              preferred_element_type=None
            ),
            conv1d=DepthwiseConv1d( # Param: 3,840 (15.4 KB)
              features=768,
              kernel_size=4,
              conv=Conv( # Param: 3,840 (15.4 KB)
                kernel_shape=(4, 1, 768),
                kernel=Param( # 3,072 (12.3 KB)
                  value=Array(shape=(4, 1, 768), dtype=dtype('float32'))
                ),
                bias=Param( # 768 (3.1 KB)
                  value=Array(shape=(768,), dtype=dtype('float32'))
                ),
                in_features=768,
                out_features=768,
                kernel_size=(4,),
                strides=1,
                padding=((0, 0),),
                input_dilation=1,
                kernel_dilation=1,
                feature_group_count=768,
                use_bias=True,
                mask=None,
                dtype=None,
                param_dtype=float32,
                precision=None,
                conv_general_dilated=<function conv_general_dilated at 0x7fa49e37c680>,
                promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
                preferred_element_type=None
              )
            ),
            dt_bias=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            A_log=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            D=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            norm=RMSNorm( # Param: 512 (2.0 KB)
              hidden_size=512,
              eps=1e-05,
              gate_residual=True,
              weight=Param( # 512 (2.0 KB)
                value=Array(shape=(512,), dtype=dtype('float32'))
              )
            ),
            out_proj=Linear( # Param: 131,072 (524.3 KB)
              kernel=Param( # 131,072 (524.3 KB)
                value=Array(shape=(512, 256), dtype=dtype('float32'))
              ),
              bias=None,
              in_features=512,
              out_features=256,
              use_bias=False,
              dtype=None,
              param_dtype=float32,
              precision=None,
              dot_general=<function dot_general at 0x7fa49e4d1440>,
              promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
              preferred_element_type=None
            )
          )
        ),
        Mamba2Block( # Param: 465,432 (1.9 MB)
          cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
          residual_in_fp32=True,
          norm=RMSNorm( # Param: 256 (1.0 KB)
            hidden_size=256,
            eps=1e-05,
            gate_residual=False,
            weight=Param( # 256 (1.0 KB)
              value=Array(shape=(256,), dtype=dtype('float32'))
            )
          ),
          mixer=Mamba2Mixer( # Param: 465,176 (1.9 MB)
            cfg=Mamba2Config(vocab_size=1, pad_token_id=0, bos_token_id=0, eos_token_id=0, hidden_size=256, state_size=128, head_dim=64, chunk_size=256, expand=2, conv_kernel=4, num_hidden_layers=2, layer_norm_epsilon=1e-05, use_bias=False, use_conv_bias=True, hidden_act='silu', emb_initializer_range=0.02, A_initializer_range=(1.0, 16.0), time_step_min=0.001, time_step_max=0.1, time_step_floor=0.0001, time_step_limit=(0.0, inf), residual_in_fp32=True, tie_word_embeddings=True),
            layer_idx=1,
            hidden_size=256,
            ssm_state_size=128,
            intermediate_size=512,
            head_dim=64,
            num_heads=8,
            chunk_size=256,
            dt_min=0.0,
            dt_max=inf,
            act=<PjitFunction of <function silu at 0x7fa49dd3b7e0>>,
            in_proj=Linear( # Param: 329,728 (1.3 MB)
              kernel=Param( # 329,728 (1.3 MB)
                value=Array(shape=(256, 1288), dtype=dtype('float32'))
              ),
              bias=None,
              in_features=256,
              out_features=1288,
              use_bias=False,
              dtype=None,
              param_dtype=float32,
              precision=None,
              dot_general=<function dot_general at 0x7fa49e4d1440>,
              promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
              preferred_element_type=None
            ),
            conv1d=DepthwiseConv1d( # Param: 3,840 (15.4 KB)
              features=768,
              kernel_size=4,
              conv=Conv( # Param: 3,840 (15.4 KB)
                kernel_shape=(4, 1, 768),
                kernel=Param( # 3,072 (12.3 KB)
                  value=Array(shape=(4, 1, 768), dtype=dtype('float32'))
                ),
                bias=Param( # 768 (3.1 KB)
                  value=Array(shape=(768,), dtype=dtype('float32'))
                ),
                in_features=768,
                out_features=768,
                kernel_size=(4,),
                strides=1,
                padding=((0, 0),),
                input_dilation=1,
                kernel_dilation=1,
                feature_group_count=768,
                use_bias=True,
                mask=None,
                dtype=None,
                param_dtype=float32,
                precision=None,
                conv_general_dilated=<function conv_general_dilated at 0x7fa49e37c680>,
                promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
                preferred_element_type=None
              )
            ),
            dt_bias=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            A_log=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            D=Param( # 8 (32 B)
              value=Array(shape=(8,), dtype=dtype('float32'))
            ),
            norm=RMSNorm( # Param: 512 (2.0 KB)
              hidden_size=512,
              eps=1e-05,
              gate_residual=True,
              weight=Param( # 512 (2.0 KB)
                value=Array(shape=(512,), dtype=dtype('float32'))
              )
            ),
            out_proj=Linear( # Param: 131,072 (524.3 KB)
              kernel=Param( # 131,072 (524.3 KB)
                value=Array(shape=(512, 256), dtype=dtype('float32'))
              ),
              bias=None,
              in_features=512,
              out_features=256,
              use_bias=False,
              dtype=None,
              param_dtype=float32,
              precision=None,
              dot_general=<function dot_general at 0x7fa49e4d1440>,
              promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
              preferred_element_type=None
            )
          )
        )
      ]),
      final_norm=RMSNorm( # Param: 256 (1.0 KB)
        hidden_size=256,
        eps=1e-05,
        gate_residual=False,
        weight=Param( # 256 (1.0 KB)
          value=Array(shape=(256,), dtype=dtype('float32'))
        )
      )
    ),
    dropout=Dropout( # RngState: 2 (12 B)
      rate=0.29,
      broadcast_dims=(),
      deterministic=True,
      rng_collection='dropout',
      rngs=RngStream( # RngState: 2 (12 B)
        tag='default',
        key=RngKey( # 1 (8 B)
          value=Array((), dtype=key<fry>) overlaying:
          [ 991576401 3935454969],
          tag='default'
        ),
        count=RngCount( # 1 (4 B)
          value=Array(18975, dtype=uint32),
          tag='default'
        )
      )
    ),
    output_proj=Linear( # Param: 257 (1.0 KB)
      kernel=Param( # 256 (1.0 KB)
        value=Array(shape=(256, 1), dtype=dtype('float32'))
      ),
      bias=Param( # 1 (4 B)
        value=Array([1.203977], dtype=float32)
      ),
      in_features=256,
      out_features=1,
      use_bias=True,
      dtype=None,
      param_dtype=float32,
      precision=None,
      dot_general=<function dot_general at 0x7fa49e4d1440>,
      promote_dtype=<function promote_dtype at 0x7fa488f76f20>,
      preferred_element_type=None
    )
  ), model_config={'model_type': 'Mamba2Regressor', 'predictor': 'cases', 'input_size': 16, 'd_model': 256, 'n_layers': 2, 'd_state': 128, 'd_conv': 4, 'expand': 2, 'head_dim': 64, 'chunk_size': 256, 'output_dim': 1, 'dropout': 0.29}, preprocessing_config={'static_covars': ['eir', 'dn0_use', 'dn0_future', 'Q0', 'phi_bednets', 'seasonal', 'routine', 'itn_use', 'irs_use', 'itn_future', 'irs_future', 'lsm'], 'after_intervention': ['dn0_future', 'itn_future', 'irs_future', 'lsm', 'routine'], 'intervention_day': 3285, 'n_steps': 157, 'model_start_day': 2190, 'window_size': 14, 'use_cyclical_time': True, 'predictor': 'cases', 'eps_prevalence': 1e-05, 'scaler_mean': [60.51631164550781, 0.31146252155303955, 0.31284299492836, 0.7976113557815552, 0.6653553247451782, 0.48366013169288635, 0.4886184334754944, 0.23791441321372986, 0.15165917575359344, 0.24229221045970917, 0.16674715280532837, 0.24511298537254333], 'scaler_scale': [106.9460678100586, 0.15838344395160675, 0.15984433889389038, 0.11796369403600693, 0.15915901958942413, 0.49973297119140625, 0.4998704493045807, 0.32026830315589905, 0.26206621527671814, 0.31967467069625854, 0.2816891670227051, 0.32141491770744324]}, scaler=<stateMINT.data.features.StandardScaler object at 0x7fa45c12f290>)})

On a machine with no outbound network, fetch the weights once somewhere that has one, copy the cache across, and set HF_HUB_OFFLINE=1 so the Hub client never attempts a call.

Warnings you can ignore

The XGBoost serialisation warning

WARNING: If you are loading a serialized model (like pickle in Python, RDS in R) or
configuration generated by an older version of XGBoost, please export the model by
calling `Booster.save_model` from that version first, then load it back in current
version.

The bundled models were serialised by an earlier XGBoost than the one you have. XGBoost loads them correctly and warns anyway, and predictions are unaffected.

The JAX CUDA warning

WARNING:jax._src.xla_bridge:An NVIDIA GPU may be present on this machine, but a
CUDA-enabled jaxlib is not installed. Falling back to cpu.

The emulator runs on JAX, and a machine with no GPU, or with a GPU but a CPU-only jaxlib, gets the absence reported once. JAX falls back to the CPU, where ten scenarios take about a second. Install "mintstate[gpu]" only if you have CUDA 12 and a batch large enough to earn it.

Results that look wrong

A flat or pinned trajectory

estiMINT clamps its inputs and raises nothing. The models were fitted on a bounded range, so prev_y9 is held to \([0.005, 0.80]\) and hbr_y9 to \([5 \times 10^{3}, 7 \times 10^{7}]\). A prevalence of 0.92 arrives at the model as 0.80 and a prevalence of 0.001 arrives as 0.005, with no warning.

A trajectory that is implausibly flat, or that will not move when you change an input that should move it, usually means the inputs sit outside the calibrated domain, either at the clamp or in a corner of covariate space the emulator never saw in training.

An unexpected rebound in prevalence

Future coverage must be set explicitly

itn_future, net_type_future and irs_future describe the campaign rather than the status quo. If itn_future is 0 or net_type_future is None, then dn0_future and itn_future are both set to 0, which models the nets being withdrawn at the campaign. irs_future does not inherit from irs either.

To hold an intervention steady, restate it.

from estimint import Scenario, EirTarget

hold = Scenario(
    name="hold", res_use=0.30, Q0=0.85, phi=0.80, seasonal=0.0, irs=0.60,
    eir_target=EirTarget(0.45, "prevalence"),
    py_only=0.70,
    itn_future=0.70, net_type_future="pyrethroid_only",  # restate the nets
    irs_future=0.60,                                     # restate the spraying
)

NaN in hbr_baseline and hbr_new

run_scenarios fills those two columns only when the scenario used a prevalence input and a non-zero mosquito_delta. mosquito_delta is ignored when input_mode is "eir" or "hbr", the density adjustment being defined on the prevalence pathway alone.

An lsm different from the one passed

run_scenarios folds a PPF net mix into effective larval source management before the emulator runs, by lsm_eff = min(py_ppf * 0.248 + lsm, 1.0). The reported lsm is lsm_eff. Please see Interventions and nets.

See also