Model Classes

Model classes
Author

Matthew Reda


source

BaseBudgetModel

 BaseBudgetModel (model_name:str, model_kpi:str,
                  model_path:str|pathlib.Path)

Abstract class for all models

Type Details
model_name str Name used to identify the model
model_kpi str Key performance indicator output by the model predict
model_path str | pathlib.Path Path to the model artifact
class BudgetModel(BaseBudgetModel):
    """
    Budget model class
    """
    ...
m = BudgetModel("Revenue Model", "Revenue", "../../example_files/fast_model")

source

BaseBudgetModel.predict

 BaseBudgetModel.predict
                          (budget:Union[Dict[str,float],xarray.core.datase
                          t.Dataset])

Predict the target variable from the input data

Type Details
budget Union Budget
Returns DataArray Predicted target variable
budget = {"a": 2, "b": .3}
prediction = m.predict(budget)


source

BaseBudgetModel.contributions

 BaseBudgetModel.contributions
                                (budget:Union[Dict[str,float],xarray.core.
                                dataset.Dataset])

Get the contributions of the input data to the target variable

Type Details
budget Union Budget
Returns Dataset Contributions of the input data to the target variable
contributions = m.contributions(budget)

Citation

BibTeX citation:
@online{reda,
  author = {Reda, Matthew},
  title = {Model {Classes}},
  url = {https://optimizer.mattreda.pro/budget_optimizer/utils/model_classes.html},
  langid = {en}
}
For attribution, please cite this work as:
Reda, Matthew. n.d. “Model Classes.” https://optimizer.mattreda.pro/budget_optimizer/utils/model_classes.html.