Ma

Mandala – Automatically save, query and version Python computations

Hacker News

Mandala – Automatically save, query and version Python computations

`mandala` is a framework I wrote to automate tracking ML experiments for my research. It differs from other experiment tracking tools by making persistence, query and versioning logic a generic part of the programming language itself, as opposed to an external logging tool you must learn and adapt to. The goal is to be able to write expressive computational code without thinking about persistence (like in an interactive session), and still have the full benefits of a versioned, queriable storage afterwards. Surprisingly, it turns out that this vision can pretty much be achieved with two generic tools: 1. a memoization+versioning decorator, `@op`, which tracks inputs, outputs, code and runtime dependencies (other functions called, or global variables accessed) every time a function is called. Essentially, this makes function calls replace logging: if you want something saved, you write a function that returns it. Using (a lot of) hashing, `@op` ensures that the same version of the function is never executed twice on the same inputs. Importantly, the decorator encourages/enforces composition. Before a call, `@op` functions wrap their inputs in special objects, `Ref`s, and return `Ref`s in turn. Furthermore, data structures can be made transparent to `@op`s, so that an `@op` can be called on a list of outputs of other `@op`s, or on an element of the output of another `@op`. This creates an expressive "web" of `@op` calls over time. 2. a data structure, `ComputationFrame`, can automatically organize any such web of `@op` calls into a high-level view, by grouping calls with a similar role into "operations", and their inputs/outputs into "variables". It can detect "imperative" patterns - like feedback loops, branching/merging, and grouping multiple results in a single object - and surface them in the graph. `ComputationFrame`s are a "synthesis" of computation graphs and relational databases, and can be automatically "exported" as dataframes, where columns are variables and operations in the graph, and rows contain values and calls for (possibly partial) executions of the graph. The upshot is that you can query the relationships between any variables in a project in one line, even in the presence of very heterogeneous patterns in the graph. I'm very excited about this project - which is still in an alpha version being actively developed - and especially about the `ComputationFrame` data structure. I'd love to hear the feedback of the HN community. Colab quickstart: https://colab.research.google.com/github/amakelov/mandala/bl... Blog post introducing `ComputationFrame`s (can be opened in Colab too): https://amakelov.github.io/mandala/blog/01_cf/ Docs: https://amakelov.github.io/mandala/

Share card

Actual performance

100points
30comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: google, single, using · Missing: mac, agents, macos
88%88% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Missing: supports, reddit linkedin, podcasting
68%68% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: excited, io · Missing: https docs, just released, exist
53%53% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoMay struggle as an AppSumo deal · Strong signals: calls · Missing: plus, platform, intuitive
40%40% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: google · Missing: mobile apps, ios, personal
37%37% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: active · Missing: arr, mrr, revenue
14%14% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

BrainTube
BrainTube51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Save once. Query anywhere.

Indie Hackerscommitment-full-time
El
ElasticQuery, a simple (Python) query builder for Elasticsearch63%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

ElasticQuery, a simple (Python) query builder for Elasticsearch

Hacker News1
A
A lib to parse Python functions for ChatGPT and call them automatically33%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A lib to parse Python functions for ChatGPT and call them automatically

Hacker News1
Py
Python OData Query Parser45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Python OData Query Parser

Hacker News1
Py
Python library to overload functions based on interpreter version64%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Python library to overload functions based on interpreter version

Hacker News45
Au
Automatically save Python shell code to file or Gist52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Automatically save Python shell code to file or Gist

Hacker News2
Py
Pyinc – a pull-based incremental query kernel for Python61%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Pyinc – a pull-based incremental query kernel for Python

Hacker News1
Ma
MakePip – Automatically Publish Python to PyPi56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

MakePip – Automatically Publish Python to PyPi

Hacker News8
Mo
Monglorious – Query MongoDB with Strings33%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Monglorious – Query MongoDB with Strings

Hacker News2
Qu
Query the national alcoholic beverage retailing monopoly of Finland43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Query the national alcoholic beverage retailing monopoly of Finland

Hacker News2