sbenthall / SHARKFin

Simulating Heterogeneous Agents with Finance
6 stars 5 forks source link

Increasing the agent population size : agent_data and AgentCount #195

Closed sbenthall closed 1 year ago

sbenthall commented 1 year ago

Related to #193 ...

https://github.com/sbenthall/SHARKFin/blob/master/sharkfin/population.py#L180-L185

So either AgentCount should always be 1, and there should be a different way to specify the size of the AgentPopulation (which would then be the number of AgentTypes in play); OR, the code should be altered so that all the agent data makes it into the agent_data dataframe.

sbenthall commented 1 year ago

@alanlujan91 Thinking this over.... The reason why we have AgentCount = 1 in WhiteShark is that the agents pay attention in groups connected to the whole AgentType: https://github.com/sbenthall/SHARKFin/blob/master/sharkfin/simulation.py#L760-L768

I.e., if there's one AgentType with AgentCount = 1000, then all agents will pay attention at once.

Accommodating a higher AgentCount and expanding it in agent_data turns out to be not too hard because of this Pandas method: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.explode.html

But it looks like we have another issue, which is that we need to be able to take an arbitrary number of agents and scale this up to multiple AgentTypes.

sbenthall commented 1 year ago

More agents, lower attention rate (so pay attention < 1 per quarter) is ideal...

sbenthall commented 1 year ago

The target for GG Shark is to be able to have multiple AgentTypes with identical properties and AgentCount = 1, so that the attention shock (currently handled in SHARKFin) can hit these agents differently.

A good place to put some that that logic would be in the build_population method: https://github.com/sbenthall/SHARKFin/blob/master/simulate/parameters.py#L10

Later, we might want to have smoother handling of this by having the attention shock work within an AgentType; but that seems like a solution for a later milestone.