simpleml.models
¶
Import modules to register class names in global registry
Expose classes in one import module
Models Directory follows this structure: Generic Base -> Library Base -> Domain Base -> Individual Models (ex: Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Subpackages¶
simpleml.models.classifiers
simpleml.models.classifiers.keras
simpleml.models.classifiers.sklearn
simpleml.models.classifiers.sklearn.base_sklearn_classifier
simpleml.models.classifiers.sklearn.dummy
simpleml.models.classifiers.sklearn.ensemble
simpleml.models.classifiers.sklearn.gaussian_process
simpleml.models.classifiers.sklearn.linear_model
simpleml.models.classifiers.sklearn.mixture
simpleml.models.classifiers.sklearn.multiclass
simpleml.models.classifiers.sklearn.multioutput
simpleml.models.classifiers.sklearn.naive_bayes
simpleml.models.classifiers.sklearn.neighbors
simpleml.models.classifiers.sklearn.neural_network
simpleml.models.classifiers.sklearn.svm
simpleml.models.classifiers.sklearn.tree
simpleml.models.classifiers.classification_mixin
simpleml.models.classifiers.external_models
simpleml.models.clusterers
simpleml.models.regressors
simpleml.models.transfer
Submodules¶
Package Contents¶
Classes¶
Main model class needs to be initialize-able in order to play nice with |
|
Specific subset of Seq2Seq models that contain encoder and decoder architectures |
|
Specific subset of Seq2Seq models that contain encoder and decoder architectures |
|
Specific subset of Seq2Seq models that contain encoder and decoder architectures |
|
Main model class needs to be initialize-able in order to play nice with |
|
Main model class needs to be initialize-able in order to play nice with |
|
Base class for sequence to sequence models. Differ from traditional models |
|
Main model class needs to be initialize-able in order to play nice with |
|
Main model class needs to be initialize-able in order to play nice with |
|
Base class for all Model objects. Defines the required |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
|
No different than base model. Here just to maintain the pattern |
-
class
simpleml.models.
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)¶ Keras returns class tuples (proba equivalent) so cast to single prediction
-
class
simpleml.models.
KerasEncoderDecoderClassifier
(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.classifiers.keras.seq2seq.KerasSeq2SeqClassifier
Specific subset of Seq2Seq models that contain encoder and decoder architectures
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={}
-
check_for_models
(self, rebuild=False)¶
-
decode
(self, X)¶
-
encode
(self, X)¶
-
class
simpleml.models.
KerasEncoderDecoderStateClassifier
(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.classifiers.keras.seq2seq.KerasEncoderDecoderClassifier
Specific subset of Seq2Seq models that contain encoder and decoder architectures with a state value to be propagated for each decoder timestep (eg LSTM/GRU decoder states)
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, end_index, max_length=None, **kwargs)¶ Inference network differs from training one so gets established dynamically at inference time. Does NOT get persisted since the weights are duplicative to the training ones. And the training network can in theory be updated with new training data later
Runs full encoder/decoder loop 1) Encodes input into initial decoder state 2) Loops through decoder state until:
End token is predicted
Max length is reached
-
class
simpleml.models.
KerasEncoderDecoderStatelessClassifier
(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.classifiers.keras.seq2seq.KerasEncoderDecoderStateClassifier
Specific subset of Seq2Seq models that contain encoder and decoder architectures withOUT a state value to be propagated for each decoder timestep. These architectures typically use repeat vectors to duplicate decoder inputs for later timesteps
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, end_index, max_length=None, **kwargs)¶ Inference network differs from training one so gets established dynamically at inference time. Does NOT get persisted since the weights are duplicative to the training ones. And the training network can in theory be updated with new training data later
Runs full encoder/decoder loop 1) Encodes input into initial decoder state 2) Loops through decoder state until:
End token is predicted
Max length is reached
-
class
simpleml.models.
KerasModel
(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_model.LibraryModel
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={}
-
abstract
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement should return the desired model object
Must return external_file
Keras pattern is: external_model = SomeWrappedKerasClass(**kwargs) return self.build_network(external_model)
-
_fit
(self)¶ Keras fit parameters (epochs, callbacks…) are stored as self.params so retrieve them automatically
-
_fit_generator
(self)¶ Keras fit parameters (epochs, callbacks…) are stored as self.params so retrieve them automatically
-
build_network
(self, external_model, **kwargs)¶ Design choice to require build network method instead of exposing raw Keras objects that can be modified later. Simplifies saving and loading pattern because initialized object should also be the final state (as long as manual override doesnt happen)
-
get_params
(self, **kwargs)¶ Get fit params
-
set_params
(self, **kwargs)¶ Keras networks don’t have params beyond layers, which should be configured in self.build_network, so use this for fit params - self.fit will auto pull params and pass them to the fit method.
TODO: Figure out if changing params should be allowed after fit. If they are, would need to reinitialize model, otherwise it would train more epochs and not forget the original training. If not, once fit, we can treat the model as static, and no longer able to be changed
For now going with option 2 - cannot refit models
-
static
transfer_weights
(new_model, old_model)¶
-
class
simpleml.models.
KerasModelClassifier
(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.classifiers.keras.base_keras_classifier.KerasClassifier
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={}
-
class
simpleml.models.
KerasSeq2SeqClassifier
(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.classifiers.keras.model.KerasModelClassifier
Base class for sequence to sequence models. Differ from traditional models because training and inference use different architectures
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)¶ Inference network differs from training one so gets established dynamically at inference time. Does NOT get persisted since the weights are duplicative to the training ones. And the training network can in theory be updated with new training data later
-
abstract
build_inference_network
(self, model)¶ Inference network - Differs from training one so gets established dynamically at inference time
return: inference_model(s) rtype: self.external_model.__class__
-
check_for_models
(self, rebuild=False)¶
-
predict
(self, X, **kwargs)¶ Seq2Seq models have unpredictable results so overwrite batch process and return arrays instead of fixed size matrix (nXm vs nX1)
-
class
simpleml.models.
KerasSequentialClassifier
(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.classifiers.keras.base_keras_classifier.KerasClassifier
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={}
-
class
simpleml.models.
LibraryModel
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.base_model.Model
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 … …
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
abstract
_fit
(self)¶ Abstract method to act as a placeholder. Inheriting classes MUST instantiate this method to manage the fit operation. Intentionally not abstracting function because each library internally configures a little differently
-
abstract
-
class
simpleml.models.
Model
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.base_model.AbstractModel
Base class for all Model objects. Defines the required parameters for versioning and all other metadata can be stored in the arbitrary metadata field
- pipeline_id: foreign key relation to the pipeline used to transform input to the model
(training is also dependent on originating dataset but scoring only needs access to the pipeline)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
__table_args__
¶
-
__tablename__
= models¶
-
pipeline
¶
-
pipeline_id
¶
-
class
simpleml.models.
SklearnAdaBoostClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnBaggingClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnBayesianGaussianMixture
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnBernoulliNB
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.base_sklearn_model.SklearnModel
,simpleml.models.classifiers.classification_mixin.ClassificationMixin
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
class
simpleml.models.
SklearnClassifierChain
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnDecisionTreeClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnDummyClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnExtraTreeClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnExtraTreesClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnGaussianMixture
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnGaussianNB
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnGaussianProcessClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnGradientBoostingClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnKNeighborsClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnLinearSVC
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnLogisticRegression
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnLogisticRegressionCV
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnMLPClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnModel
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.base_model.LibraryModel
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_fit
(self)¶ Separate out actual fit call for optional overwrite in subclasses
Sklearn estimators don’t support data generators, so do not expose fit_generator method
-
-
class
simpleml.models.
SklearnMultiOutputClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnMultinomialNB
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnNuSVC
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnOneVsOneClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnOneVsRestClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnOutputCodeClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnPerceptron
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnRandomForestClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnRidgeClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnRidgeClassifierCV
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnSGDClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnSVC
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-
-
class
simpleml.models.
SklearnVotingClassifier
(has_external_files=True, external_model_kwargs=None, params=None, **kwargs)[source]¶ Bases:
simpleml.models.classifiers.sklearn.base_sklearn_classifier.SklearnClassifier
No different than base model. Here just to maintain the pattern Generic Base -> Library Base -> Domain Base -> Individual Models (ex: [Library]Model -> SklearnModel -> SklearnClassifier -> SklearnLogisticRegression)
Need to explicitly separate passthrough kwargs to external models since most do not support arbitrary **kwargs in the constructors
-
_create_external_model
(self, **kwargs)¶ Abstract method for each subclass to implement
should return the desired model object
-