from greenwood.summaries import register_tidier
# Define a tidy adapter that delegates to the model's own output
def _tidy_my_model(model, *, format=None, **kwargs):
return model.to_frame(format=format)
# Register the adapter for the custom model class
register_tidier("mypackage.MyModel", _tidy_my_model)summaries.register_tidier()
Register a tidy adapter for a model class.
Usage
summaries.register_tidier(
class_path,
fn,
)This is the extension point for adding tidy() support to new estimator classes. Each adapter is a callable that accepts a fitted model as its first argument (plus optional keyword arguments like format=) and returns a tidy DataFrame.
Parameters
class_path: str-
Fully qualified class name used as the registry key, e.g.,
"greenwood._cox.CoxPH". Using the string path avoids eager imports. fn: Tidier-
Callable with signature
fn(model, *, format=None, **kwargs) -> DataFrame.
Examples
Register a custom tidy adapter for a new estimator class: