Model Interface
BaseModel(model=None, change=False, model_path='', backend='Func')
Bases: ABC
Initialize Base Model. Arguments: model: trained ML Model, either the model or the direct function call for returning the probability distribution. change bool: True if dimension change is necessary. model_path str: path to trained model. backend str: ML framework. For frameworks other than TensorFlow (TF), Sklearn (SK) or PyTorch (PYT), provide 'Func'.
load_model(path)
abstractmethod
Loads the model provided at the given path. Arguments: path str: Path to the trained model- Returns: loaded model.
predict(item)
abstractmethod
Unified prediction function. Arguments: item np.array: item to be classified Returns: an array of output scores for a classifier, and a singleton array of predicted value for a regressor.
TensorFlowModel(model, change=False)
Bases: BaseModel
Wrapper for Tensorflow Models that unifiy the prediction function for a classifier. Arguments: model : Trained TF Model. change bool: if swapping of dimension is necessary = True
predict(item)
Unified prediction function. Arguments: item np.array: item to be classified. Returns: an array of output scores for a classifier.
Module containing an interface to trained PyTorch model.
PyTorchModel(model, change=False)
Bases: BaseModel
Wrapper for PyTorch Models that unifiy the prediction function for a classifier. Arguments: model : Trained PYT Model. change bool: if swapping of dimension is necessary = True
predict(item)
Unified prediction function. Arguments: item np.array: item to be classified. Returns: an array of output scores for a classifier.
SklearnModel(model, change=False)
Bases: BaseModel
Wrapper for Sklearn Models that unifiy the prediction function for a classifier. Arguments: model : Trained Sklearn Model. change bool: if swapping of dimension is necessary = True
predict(item)
Unified prediction function. Arguments: item np.array: item to be classified. Returns: an array of output scores for a classifier.