Skip to content

Added early draft of labor model example. - #36

Open
ohaaga wants to merge 20 commits into
AlgebraicJulia:mainfrom
ohaaga:add_labor_model
Open

ohaaga wants to merge 20 commits into
AlgebraicJulia:mainfrom
ohaaga:add_labor_model

Conversation

@ohaaga

@ohaaga ohaaga commented Aug 8, 2024

Copy link
Copy Markdown
Contributor

Any and all comments welcome.

@kris-brown kris-brown added the documentation Improvements or additions to documentation label Aug 22, 2024
@kris-brown
kris-brown self-requested a review August 22, 2024 16:25

@kris-brown kris-brown left a comment

Copy link
Copy Markdown
Collaborator

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!

Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl
Comment thread docs/literate/labor_model.jl
Comment thread docs/literate/labor_model.jl Outdated
# 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.
#

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Contributor Author

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.

Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl
Comment thread docs/literate/labor_model.jl
death_abm_rule = ABMRule(:Death, death, ContinuousHazard(1));

people_only_abm = ABM([birth_abm_rule, death_abm_rule]);

Copy link
Copy Markdown
Collaborator

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?

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Collaborator

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!

Copy link
Copy Markdown
Contributor Author

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).

Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread docs/literate/labor_model.jl Outdated
Comment thread 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"identitiy"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread 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

Copy link
Copy Markdown
Collaborator

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Killed that sentence.

Comment thread 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

Copy link
Copy Markdown
Collaborator

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.

Comment thread 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.

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave it a try.

Comment thread 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

Copy link
Copy Markdown
Collaborator

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).

Copy link
Copy Markdown
Contributor Author

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]);

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Collaborator

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 |>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semicolon again

Comment thread docs/literate/labor_model.jl Outdated
) # hide
end # hide

plot_beveridge_curve(result) # hide No newline at end of file

Copy link
Copy Markdown
Collaborator

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!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the figure has a legend with "y1" as the name of the line - maybe you can rename it or remove the legend?
Screenshot 2024-10-24 at 5 52 17 PM

ohaaga and others added 2 commits December 4, 2024 20:52
…wing an error with the versions of other libraries that I'm using.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants