Interface API

The goal of this API is to provide a clear interface for converting model internals into labeled pandas DataFrames.

Creating the Interface

from wt_ml.interface import create_interface

# assume gt_model is an instance of an existing trained model
# assume dataset is an instance of an EconomicDataset

# to populate the interface, we need to provide a full example of model intermediaries
example_input = next(dataset())
example_intermediaries = gt_model(example_input, training=False, debug=True, skip_metrics=True)

# this will create the overall interface. Note that dataset is optional, if you do not pass it here
# you will be required to pass it when calling the interface objects. Similarly, you do not have to
# pass example_intermediaries, but then the only registered interfaces will be those in wt_ml/interface/custom
interface = create_interface(gt_model, example_intermediaries, dataset=dataset)

Using the Interface

The interface will now have a bunch of assigned properties. Once loaded, you can use tab completion. Here are some simple examples of getting specific dataframes from the interface.

NY_weather_impact = interface.weather_me.impact_by_signal(state=["New York"])
NON_BDL_roicurve_beta_coef = interface.roicurve_betagamma.beta(brand=["BDL"], brand_invert=True)

Full API Description

... Coming Soon

Registering Custom Data Overrides

... Coming Soon

Differentiating Between Tensors

... Coming Soon