opendataval.model#

Prediction models to be trained, predict, and evaluated.

Models#

Model is an ABC used to take an existing model and make it compatible with the DataEvaluator and other related objects.

API#

Model()

Abstract class of Models.

GradientModel()

Provides access to gradients of a Model

ModelFactory(model_name[, fetcher, device])

Factory to create prediction models from specified presets

Torch Mixins#

TorchClassMixin(*args, **kwargs)

Classifier Mixin for Torch Neural Networks.

TorchRegressMixin(*args, **kwargs)

Regressor Mixin for Torch Neural Networks.

TorchPredictMixin(*args, **kwargs)

Torch .predict() method mixin for Torch Neural Networks.

TorchGradMixin(*args, **kwargs)

Gradient Mixin for Torch Neural Networks.

Sci-kit learn wrappers#

ClassifierSkLearnWrapper(base_model, ...)

Wrapper for sk-learn classifiers that can have weighted fit methods.

ClassifierUnweightedSkLearnWrapper(...)

Wrapper for sk-learn classifiers that can don't have weighted fit methods.

RegressionSkLearnWrapper(base_model, *args, ...)

Wrapper for sk-learn regression models.

Default Hyperparameters#

\[ \begin{align}\begin{aligned}\newcommand\T{\Rule{0pt}{1em}{.3em}}\\\begin{split}\begin{array}{llll} \hline \textbf{Algorithm} & \textbf{Hyperparameter} & \textbf{Default Value} & \textbf{Key word argument} \\ \hline \mbox{Logistic Regression} & \mbox{epochs} & 1 & \mbox{yes} \\ & \mbox{batch size} & 32 & \mbox{yes} \\ & \mbox{learning rate} & 0.01 & \mbox{yes} \\ & \mbox{optimizer} & \mbox{ADAM} & \mbox{no} \\ & \mbox{loss function} & \mbox{Cross Entropy} & \mbox{no} \\ \hline \mbox{MLP Classification} & \mbox{epochs} & 1 & \mbox{yes} \\ & \mbox{batch size} & 32 & \mbox{yes} \\ & \mbox{learning rate} & 0.01 & \mbox{yes} \\ & \mbox{optimizer} & \mbox{ADAM} & \mbox{no} \\ & \mbox{loss function} & \mbox{Cross Entropy} & \mbox{no} \\ \hline \mbox{BERT Classification} & \mbox{epochs} & 1 & \mbox{yes} \\ & \mbox{batch size} & 32 & \mbox{yes} \\ & \mbox{learning rate} & 0.001 & \mbox{yes} \\ & \mbox{optimizer} & \mbox{ADAMW} & \mbox{no} \\ & \mbox{loss function} & \mbox{Cross Entropy} & \mbox{no} \\ \hline \mbox{LeNet-5 Classification} & \mbox{epochs} & 1 & \mbox{yes} \\ & \mbox{batch size} & 32 & \mbox{yes} \\ & \mbox{learning rate} & 0.01 & \mbox{yes} \\ & \mbox{optimizer} & \mbox{ADAM} & \mbox{no} \\ & \mbox{loss function} & \mbox{Cross Entropy} & \mbox{no} \\ \hline \mbox{MLP Regression} & \mbox{epochs} & 1 & \mbox{yes} \\ & \mbox{batch size} & 32 & \mbox{yes} \\ & \mbox{learning rate} & 0.01 & \mbox{yes} \\ & \mbox{optimizer} & \mbox{ADAM} & \mbox{no} \\ & \mbox{loss function} & \mbox{Mean Square Error} & \mbox{no} \\ \hline \end{array}\end{split}\end{aligned}\end{align} \]

Functions

ModelFactory(model_name[, fetcher, device])

Factory to create prediction models from specified presets