Skip to content

memo 0.2.0 "August"

Pre-release
Pre-release
Compare
Choose a tag to compare
@kach kach released this 17 Aug 21:51
· 133 commits to main since this release

Upgrade with: pip install memo-lang --upgrade

Breaking changes ⚠️

  • Output dimensions now appear in the same order as specified the @memo definition (previously they were reversed). The easiest way to transition your existing memo code is to .transpose() the output array produced by each memo.

Performance 🐎

  • memo has a brand-new compilation strategy that produces code that is orders of magnitude faster, and dramatically more memory-efficient as well, especially for deeply nested recursive calls (e.g. when performing many rounds of value iteration).

New comforts 🕹️

  • You can now use Pr[…] to measure probabilities (previously you had to use E[…] which may be unintuitive). Pr is simply syntactic sugar for E.
  • There are several new helpful error messages: forgetting to put type annotations, forgetting to use the choice in wpp=…, etc.
  • Error messages now also include your current memo version.
  • The "cast" statement is now optional.
  • You can now pass in multiple variables to knows, as in alice: knows(x, y, z, …). Previously those had to be separate knows statements.

New features 🎁

  • memo now has a little library for helping define complicated domains — similar to Python's namedtuple, but internally representing cartesian products as a flattened index from 0 to N. This is useful, e.g., if you want a grid-world state space S that has an X and Y component: memo now automatically does the tricky indexing arithmetic to convert (x, y) to and from (y * width + x).

Upcoming features 👾

  • memo now has a small experimental library to compile your memo to a little "comic book" diagram that shows the different "frames of mind," and the variables defined in each such "frame." This can be helpful for producing figures for a paper/talk, as well as for debugging/better understanding your own models. This feature is very rough right now but expect it to improve during the 0.2.x series.

For developers 🛠️

  • memo now supports a few internal debugging flags:
    1. You can use @memo(debug_print_compiled=True) to print the compiled source code produced internally by memo.
    2. The flag debug_trace=True prints a note every time a memo is invoked. This is useful for debugging performance bottlenecks with recursive queries.
    3. Finally, save_comic=(path) triggers the WIP comic generator.