model_function.py

This example shows defining a custom model class using a function.

from modelrunner import make_model


def multiply(a, b=2):
    return a * b


# create an instance of the model defined by the function
model = make_model(multiply, {"a": 3})
# run the instance
print(model())