simpleml.models.classifiers.keras.base_keras_classifier

Base module for keras classifier models

Module Contents

Classes

KerasClassifier

Main model class needs to be initialize-able in order to play nice with

simpleml.models.classifiers.keras.base_keras_classifier.__author__ = Elisha Yadgaran[source]
class simpleml.models.classifiers.keras.base_keras_classifier.KerasClassifier(use_training_generator=False, training_generator_params=None, use_validation_generator=False, validation_generator_params=None, use_sequence_object=False, **kwargs)[source]

Bases: simpleml.models.base_keras_model.KerasModel, simpleml.models.classifiers.classification_mixin.ClassificationMixin

Main model class needs to be initialize-able in order to play nice with database persistence and loading. This class is the in between that defines the expected methods for each extended library.

Examples: Scikit-learn estimators –> SklearnModel(LibraryModel): … Keras estimators –> KerasModel(LibraryModel): … PyTorch … …

Pass default save method as Keras’s persistence pattern

Parameters
  • use_training_generator (Bool) – Whether to propagate use of a generator object when training – does not allow for using a generator in production – only fit_generator

  • use_validation_generator (Bool) – Whether to ALSO use a generator for validation data while training. Does nothing if use_training_generator is false

  • training_generator_params – parameters to pass to the generator method for train split - normal fit(_generator) params should be passed as params={}

  • validation_generator_params – parameters to pass to the generator method for validation split - normal fit(_generator) params should be passed as params={}

_predict(self, X, **kwargs)[source]

Keras returns class tuples (proba equivalent) so cast to single prediction