Skip to content

Conversation

antonlaukemper
Copy link

change some old links and include the texts from the paper.
What is the Leviathan example? I think this would also need an introduction?

@antonlaukemper
Copy link
Author

I think in the SimilarityAdoption notebook a cell got lost. Right under the cell with "First, let's check whether all runs have converged:"

@antonlaukemper
Copy link
Author

antonlaukemper commented Jan 21, 2021

I was unable to run the ModularNetwork notebook because of the following error when I ran the cell with step 1: initializing the simulation

`NameError Traceback (most recent call last)
in ()
----> 1 sim.initialize_simulation()
2 components = [i for i in nx.connected_components(sim.network)]
3 for node in components[0]:
4 sim.network.nodes[node]['color'] = 'blue'
5 for node in components[1]:

~\Miniconda3\lib\site-packages\defSim\Simulation.py in initialize_simulation(self)
217
218 # initialize agent attributes (accepts string realizations and instances of AttributesInitializer classes)
--> 219 agents_init.initialize_attributes(self.network, self.attributes_initializer, **self.parameter_dict)
220
221 # initialization of distances between neighbors

~\Miniconda3\lib\site-packages\defSim\agents_init\agents_init.py in initialize_attributes(network, realization, **kwargs)
115 RandomContinuousInitializer.RandomContinuousInitializer(**kwargs).initialize_attributes(network)
116 elif realization == 'correlated_continuous':
--> 117 CorrelatedContinuousInitializer.CorrelatedContinuousInitializer(**kwargs).initialize_attributes(network)
118 elif isinstance(realization, AttributesInitializer):
119 realization.initialize_attributes(network)

~\Miniconda3\lib\site-packages\defSim\agents_init\CorrelatedContinuousInitializer.py in initialize_attributes(self, network)
140 if self.postprocessing_iterations == 'convergence' or self.postprocessing_iterations > 0:
141 similarity_postprocessor = SimilarityPostprocessor(network, self.dissimilarity_criterion, feature_names,
--> 142 neighbor_similarity_feature)
143 similarity_postprocessor.process(self.postprocessing_iterations)
144

NameError: name 'neighbor_similarity_feature' is not defined`

@dimaba
Copy link

dimaba commented Jan 22, 2021

I was unable to run the ModularNetwork notebook because of the following error when I ran the cell with step 1: initializing the simulation
[...]
NameError: name 'neighbor_similarity_feature' is not defined`

Found the problem for this one: missed a reference to neighbor_similarity_feature when changing the neighbor similarity feature to an attribute rather than a parameter of the function. Should be self.neighbor_similarity_feature.
https://github.com/defSim/defSim/blob/62b36532e8735d5d338f5c2d1ba804ddaafcbb29/defSim/agents_init/CorrelatedContinuousInitializer.py#L141-L142

I can update this later, and this fix should be included in the defSim version we share for review.

@antonlaukemper
Copy link
Author

Nice!
Is the version I'm downloading with 'pip install defSim' always the most uptodate?

@dimaba
Copy link

dimaba commented Jan 24, 2021

The version you get from GitHub should be the most up to date, the pip version can be a bit behind (we have to manually release a new version to PyPi). The above issue is fixed in the main GitHub branch now. The example still won't run, because apparently a parameter in one of the networkx functions was removed at some point. If you change that the example works.

However, the results seem to be inconsistent from run to run despite having fixed the seed. Haven't looked into that yet, but we should definitely figure out why that is.

@antonlaukemper
Copy link
Author

If you change that the example works.

which parameter do you mean?

@dimaba
Copy link

dimaba commented Feb 3, 2021

The following line is from the example:
nc = nx.draw_networkx_nodes(network, pos, nodelist=nodes, node_color=colors, with_labels=False, node_size=100, map=plt.cm.winter, vmin=0, vmax=1)
The parameter with_labels was apparently removed at some point. When trying to run the example it complains about an unrecognized parameter. If you change this to
nc = nx.draw_networkx_nodes(network, pos, nodelist=nodes, node_color=colors, node_size=100, map=plt.cm.winter, vmin=0, vmax=1)
(removing the with_labels parameter) the example works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants