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

[generic_imitation] imi_p_imitate not working properly #152

Open
leander-j opened this issue Dec 9, 2021 · 2 comments · May be fixed by #156
Open

[generic_imitation] imi_p_imitate not working properly #152

leander-j opened this issue Dec 9, 2021 · 2 comments · May be fixed by #156
Assignees
Labels

Comments

@leander-j
Copy link

leander-j commented Dec 9, 2021

The imitation process appears to be independent of imi_p_imitate both for 'simple' and 'complex' contagion. Setting it to 0.1 or 1.0 makes no difference. For the 'simple' case even setting it to 0.0 does not stop imitation.

example config:

culture = M.Culture(
    imi_rate = {
        'bool': 100,   # -> 10000 updates
        'ord': 0,  # *10 in batch -> 10000 updates
        'pair': 0, # *~50 in batch -> 10000 updates
        '*': 0,
        },
    imi_type = 'complex',
    imi_batch_n = {'bool': 2, 'ord': 10},
    imi_p_in_batch = {'pair': 0.5},
    imi_network = M.Culture.acquaintance_network,
    imi_p_neighbor_drawn = {'pair': 1.0},
    imi_n_neighbors_drawn = {'bool': 10, 'ord': 20},
    imi_rel_threshold = {'bool': { 
            ((False,),(True,)): 0.0, 
            ((True,),(False,)): 0.0
        }},
    imi_abs_threshold = {'ord': 2, 'pair': 0},
    imi_include_own_trait = {'pair': True, '*': False},
    imi_delta = {'pair': 10.0},  # evaluation will be done by Individual.imi_evaluate_pair
    imi_p_imitate = {'pair': 1.0, 'bool': 0.0}  # for 'ord', the value is set by Cell.imi_p_imitate_ord
    )
@leander-j
Copy link
Author

leander-j commented Dec 10, 2021

Another error with imi_p_imitate: Setting it only for some of the traits (e.g. all but 'bool') yields an error message. Not setting it at all does not. It then shows the same behavior as setting it to any specific value (as in the bug described above).

When not setting a value for a specific trait, imi_p_imitate should be set to default. Also: I could not find any defaults in the documentation for the parameters.

To replicate use above config but change:

    imi_p_imitate = {'pair': 1.0}  # for 'ord', the value is set by Cell.imi_p_imitate_ord

Error message:

Traceback (most recent call last):
  File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/studies/_testing/generic_imitation_simple.py", line 119, in <module>
    traj = doit()
  File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/studies/_testing/generic_imitation_simple.py", line 114, in doit
    res = runner.run(t_0=0, t_1=t_1, dt=1)
  File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/pycopancore/runners/runner.py", line 592, in run
    method(inst, t)
  File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/pycopancore/model_components/generic_imitation/implementation/culture.py", line 469, in perform_event
    self.trigger_imitation(key)
  File "/home/leander/Documents/Studium/13/Masterthesis/pycopancore/pycopancore/model_components/generic_imitation/implementation/culture.py", line 399, in trigger_imitation
    if actual_p_imitate > 0:
TypeError: '>' not supported between instances of 'NoneType' and 'int'

@mensch72
Copy link
Contributor

the default can be set this way:

    imi_p_imitate = {'pair': 1.0, '*': 0.0} 

@mensch72 mensch72 linked a pull request Dec 10, 2021 that will close this issue
@leander-j leander-j changed the title imi_p_imitate not working properly [generic_imitation] imi_p_imitate not working properly Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants