def test_algorithmic_bias_model(self): g = nx.complete_graph(100) model = opn.AlgorithmicBiasModel(g) config = mc.Configuration() config.add_model_parameter("epsilon", 0.32) config.add_model_parameter("gamma", 1) model.set_initial_status(config) iterations = model.iteration_bunch(10) self.assertEqual(len(iterations), 10) iterations = model.iteration_bunch(10, node_status=False) self.assertEqual(len(iterations), 10)
def test_algorithmic_bias_model(self): for g in get_graph(): model = opn.AlgorithmicBiasModel(g, seed=0) config = mc.Configuration() config.add_model_parameter("epsilon", 0.32) config.add_model_parameter("gamma", 1) model.set_initial_status(config) iterations = model.iteration_bunch(10) self.assertEqual(len(iterations), 10) iterations = model.iteration_bunch(10, node_status=False) self.assertEqual(len(iterations), 10) _ = model.steady_state(max_iterations=100)
def test_opinion_viz(self): g = nx.complete_graph(50) model = op.AlgorithmicBiasModel(g) # Model configuration config = mc.Configuration() config.add_model_parameter("epsilon", 0.32) config.add_model_parameter("gamma", 0) model.set_initial_status(config) # Simulation execution iterations = model.iteration_bunch(50) viz = OpinionEvolution(model, iterations) viz.plot("opinion_ev.png") os.remove("opinion_ev.png")