Source code for simpleml.models.external_models

'''
Base Module for all external models

Inherit and extend for particular models
'''

__author__ = 'Elisha Yadgaran'


from simpleml.persistables.meta_registry import KerasRegistry
from future.utils import with_metaclass


[docs]class ExternalModelMixin(with_metaclass(KerasRegistry, object)): ''' Wrapper class for a pickleable model with expected methods Expected to be used as Mixin Class with default methods and ovewritten by the model class if methods exist ex: from some_model_library import ActualModelClass class WrappedActualModelClass(ActualModelClass, ExternalModelMixin): pass class some_model_libraryActualModelClass(Model, [optional mixins]): def _create_external_model(self, **kwargs): return WrappedActualModelClass(**kwargs) '''
[docs] def fit(self, *args, **kwargs): ''' By default nothing is implemented ''' raise NotImplementedError
[docs] def predict(self, *args, **kwargs): ''' By default nothing is implemented ''' raise NotImplementedError
[docs] def get_params(self, *args, **kwargs): ''' By default nothing is implemented ''' return {}
[docs] def set_params(self, *args, **kwargs): ''' By default nothing is implemented '''
[docs] def score(self, *args, **kwargs): ''' By default nothing is implemented ''' raise NotImplementedError
[docs] def get_feature_metadata(self, *args, **kwargs): ''' By default nothing is implemented ''' return None