-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added early draft of labor model example. #36
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I haven't gotten to the rules part, but here are some initial thoughts on the beginning!
docs/literate/labor_model.jl
Outdated
# change which can occur in our model. These will take the form of ACSet rewriting rules, | ||
# which are a generalization of graph rewriting rules (since a graph can be defined as a | ||
# relatively simple ACSet, or indeed CSet). We will use Double Pushout and Single Pushout | ||
# rewriting, which both take an input pattern of the form L <- I -> R, where L is the input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think inline LaTeX will be good here for things like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little better now? Didn't go full LaTeX.
# pattern to be matched in the existing state of the world ("Before"), R is the output | ||
# pattern that should exist going forward ("After") and I is the pattern of items in the | ||
# input match which should carry over into the output match. | ||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere between this first and second paragraph of this section, you should introduce the concept (perhaps even at just an intuitive level) of what an "ACSet Transformation" is, since if I'm not mistaken I don't see it introduced anywhere else but it gets highly used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a line. May want to discuss audience expectations in a larger sense.
death_abm_rule = ABMRule(:Death, death, ContinuousHazard(1)); | ||
|
||
people_only_abm = ABM([birth_abm_rule, death_abm_rule]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to show a plot here of the population just to make this point before going to the more complicated ABM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great minds think alike. I'll add it back in once we have SPO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heads up I don't see this added back in!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some graphs of the people only ABM (with and without firms).
docs/literate/labor_model.jl
Outdated
# in the labour market using this "market tightness" ratio. | ||
|
||
function market_tightness(state_of_world::LaborMarket) | ||
length(state_of_world.parts.Vacancy)/number_unemployed(state_of_world) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use nparts(state_of_world, :Vacancy)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
docs/literate/labor_model.jl
Outdated
# ## Background | ||
# Inspired by the search-and-matching ABM implementation in [del Rio-Chanona et. al. (2022)](https://royalsocietypublishing.org/doi/suppl/10.1098/rsif.2020.0898), | ||
# we demonstrate a very basic ABM of a [labor market seach-and-matching model](https://en.wikipedia.org/wiki/Search_and_matching_theory_(economics)). | ||
# A state-of-the-world in our model will be represented by an ACSet on a schema that we define, and the model itself |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "state of the world" (in quotes) rather than with dashes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
docs/literate/labor_model.jl
Outdated
# Since the ACSet rewrite rules are defined using ACSet instances and the homomorphisms (or ACSet Transformations) between | ||
# them, it will be useful to revise [Catlab.jl](https://github.com/AlgebraicJulia/Catlab.jl) and | ||
# [AlgebraicRewriting.jl](https://github.com/AlgebraicJulia/AlgebraicRewriting.jl) functions for creating them. | ||
# In practice, the rules below are defined using identitiy morphisms on coproducts of representables and homomorphism search for unique homomorphisms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"identitiy"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
docs/literate/labor_model.jl
Outdated
# Since the ACSet rewrite rules are defined using ACSet instances and the homomorphisms (or ACSet Transformations) between | ||
# them, it will be useful to revise [Catlab.jl](https://github.com/AlgebraicJulia/Catlab.jl) and | ||
# [AlgebraicRewriting.jl](https://github.com/AlgebraicJulia/AlgebraicRewriting.jl) functions for creating them. | ||
# In practice, the rules below are defined using identitiy morphisms on coproducts of representables and homomorphism search for unique homomorphisms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit much to throw technical terms like "coproducts of representables" and "homomorphism search" at them without context in the "Background" section (at least with ACSets you have a link to the Github which has a public-friendly README, but even with that I wouldn't count on people clicking the link ... rather they might just end up confused / thinking this post isn't for them).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Killed that sentence.
docs/literate/labor_model.jl
Outdated
# between them. | ||
# | ||
# ## Schema | ||
# We define our Schema "from scratch" by specifying the types of objects in our model and the mappings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm this post doesn't talk about any other ways to define a schema so "from scratch" might not make sense (not clear what you're contrasting it with) - I think what you wrote makes sense without that qualifier.
docs/literate/labor_model.jl
Outdated
# | ||
# ## Schema | ||
# We define our Schema "from scratch" by specifying the types of objects in our model and the mappings | ||
# (or "homomorphisms") between them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if 'mapping' or 'homomorphism' is the right term to use here (of course, they're both unambiguously fine to use among people who know what they're talking about!). To see my worry: if you ctrl+f "mapping" or "homomorphism" in the rest of the blog post, it gets used exclusively to mean C-Set homomorphism, which is very different from an arrow in the schema. Maybe when introducing it you could say that declaring a schema is declaring the types of objects/entities (denoted by Ob
in the code below) and the functional relationships between them (denoted by Hom
). There's a risk someone becomes confused ("why is it called Hom
?") but I worry about the other kind of confusion more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave it a try.
docs/literate/labor_model.jl
Outdated
# functions. As an alternative, we can specify some basic elements of our instances by | ||
# taking the freely constucted minimal example of each of our entities ("objects" - but | ||
# not in the sense of Object-Oriented Programming). This creates a "generic" instance | ||
# of the chosen entity, which in particular doesn't force any two objects to be the same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a different use of 'object' than the sentence which immediately precedes it (the free instance does not force any two parts to be the same ... e.g. E
and V
are objects in SchGraph
but V#1
and V#2
of a particular graph are parts). I don't know if anyone who hasn't worked a lot with ACSets before will quite understand this sentence anyways (saying that it's generic might be enough to communicate to readers what a representable is, and the examples to follow will solidify their intuition).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing to "parts" - would you recommend dropping that clause entirely? I don't know that "freely constructed" will convey that fully to users.
death_abm_rule = ABMRule(:Death, death, ContinuousHazard(1)); | ||
|
||
people_only_abm = ABM([birth_abm_rule, death_abm_rule]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heads up I don't see this added back in!
id(P⊕F) | ||
); | ||
|
||
# We assume at first that hiring and firing occur at constant rates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a semicolon here in order to prevent it from printing out an ABM (which looks massive/ugly because we don't pretty print that data structure)
end | ||
) |> ClosureState; | ||
|
||
full_abm = @pipe constant_job_dynamics_abm |> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semicolon again
docs/literate/labor_model.jl
Outdated
) # hide | ||
end # hide | ||
|
||
plot_beveridge_curve(result) # hide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain very briefly (provide a link) what Beveridge is?
Also a concluding sentence would be nice so that the piece doesn't abruptly end!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…wing an error with the versions of other libraries that I'm using.
Any and all comments welcome.