Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an IPM warning when symbol and attribute isn't used in edges #145

Closed
ewilli1 opened this issue Aug 15, 2024 · 0 comments · Fixed by #216
Closed

Add an IPM warning when symbol and attribute isn't used in edges #145

ewilli1 opened this issue Aug 15, 2024 · 0 comments · Fixed by #216
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ewilli1
Copy link

ewilli1 commented Aug 15, 2024

Suggest a warning message for users when an IPM has attributes and symbols that are not used within the edges. Joe and I discussed this in a meeting. The code below should show an example where gamma is an attribute with the y symbol but it's not used in the edges so having a warning message or alert of some kind in a scenario like this is the idea.

def construct_ipm():
    symbols = create_symbols(
        compartments=[
            compartment('S'),
            compartment('I'),
            compartment('R'),
            compartment('H'),
        ],
        attributes=[
            AttributeDef('beta', type=float, shape=Shapes.TxN,
                         comment='infectivity'),
            AttributeDef('gamma', type=float, shape=Shapes.TxN,
                         comment='infectivity'),
            AttributeDef('xi', type=float, shape=Shapes.TxN,
                         comment='progression from recovered to susceptible'),
            AttributeDef('h_rate', type=float, shape=Shapes.TxN,
                         comment='progression from infected to hospitalized'),
            AttributeDef('h_recovery', type=float, shape=Shapes.TxN,
                         comment='progression from hospitalized to recovered'),
            AttributeDef('h_prob', type=float, shape=Shapes.TxN,
                         comment='probablity for hospital versus recovered'),
        ])

    [S, I, R, H] = symbols.compartment_symbols
    [β, y, ξ, h_rate, h_rec, h_prob] = symbols.attribute_symbols

    N = Max(1, S + I + R)

    return create_model(
        symbols=symbols,
        transitions=[
            edge(S, I, rate=β * S * I / N),
            fork(
                edge(I, H, rate=h_rate * I * h_prob),
                edge(I, R, rate=h_rate * I * (1 - h_prob)),
            ),
            edge(H, R, rate=h_rec * H),
            edge(R, S, rate=ξ * R)
        ])
SIRH_ipm = construct_ipm()  # store hospitalization ipm
@ewilli1 ewilli1 added the enhancement New feature or request label Aug 15, 2024
@JavadocMD JavadocMD added this to the v0.9 milestone Dec 18, 2024
@JavadocMD JavadocMD linked a pull request Dec 19, 2024 that will close this issue
@JavadocMD JavadocMD self-assigned this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants