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

Create BinaryVariable state object #30

Open
giovannic opened this issue Oct 5, 2020 · 6 comments
Open

Create BinaryVariable state object #30

giovannic opened this issue Oct 5, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request large We have estimated that the issue would take a more than usual development time (3 points)

Comments

@giovannic
Copy link
Member

Models often include binary variables that are not mutually exclusive (like State objects). These are currently modelled with Variables using 1 and 0. Investigate and integrate performant alternatives.

@giovannic giovannic added enhancement New feature or request large We have estimated that the issue would take a more than usual development time (3 points) labels Oct 5, 2020
@giovannic giovannic self-assigned this Oct 5, 2020
@giovannic
Copy link
Member Author

Categorical variable?

@slwu89
Copy link
Collaborator

slwu89 commented Feb 5, 2021

If I wanted to create a model of, for example, house to house transmission where each agent's current house belongs to a discrete set where all possible combinations of infection states and houses are possible "states" for the agent, I should wait for this update?

@giovannic
Copy link
Member Author

Currently it's only possible using a few Variable objects as indicators for each state and doing something like:

contains_susceptible = individual::Variable$new(house, rep(0, population))
contains_infected = individual::Variable$new(house, rep(0, population))
contains_recovered = individual::Variable$new(house, rep(0, population))

process <- function(api) {
  # do something with houses which have susceptible and infected
  both <- (api$get_variable(house, contains_susceptible) == 1) & (api$get_variable(house, contains_infected) == 1)
  ...
}

This is not ideal. It sounds like this issue would suit you better but I can't give an estimate on when that will be available.

@slwu89
Copy link
Collaborator

slwu89 commented Feb 8, 2021

Is this something I could help out with? It looks like this is a special case of issue #47 that you mentioned, maybe something like Categorical could cover all these discrete non-mutually exclusive aspects of state?

@giovannic
Copy link
Member Author

Ok great!

So we intend Categorical to be mutually exclusive, and MultiCategory to be non-mutually exclusive.

Categorical is going to be introduced in #46, currently WIP on feat/variable_refactor. It's not fully tested and documented yet though :/

If you're keen to use MultiCategory now, you could branch off of feat/variable_refactor and implement MultiCategory. We could then it in once the refactor is complete. I have added some extra TODO notes on #47 if you want to go down that route.

@slwu89
Copy link
Collaborator

slwu89 commented Feb 10, 2021

Oh cool, that's very clear! Thanks for pointing me to the extra notes on #47, I'll need to study the refactored API a bit before starting those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request large We have estimated that the issue would take a more than usual development time (3 points)
Projects
None yet
Development

No branches or pull requests

2 participants