Models

class optexp.models.Model[source]

Abstract base class for models.

class optexp.models.Linear(bias: bool = True)[source]

A linear model for regression or classification.

Can take inputs of any shape, and will flatten them first.

Parameters:

bias (bool, optional) – whether to include a bias term. Defaults to True.

class optexp.models.LeNet5[source]

A basic convolutional neural network for image classification from [LeCun1998].

The model expects images of shape [batch, channels, 32, 32]. If images are 28x28, the model will pad the images to 32x32.

[LeCun1998]

Gradient Based Learning Applied to Document Recognition. Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Proceedings of the IEEE, 86(11):2278-2324, 1998. DOI: 10.1109/5.726791

class optexp.models.ResNet(size: Literal[18, 34, 50, 101, 152])[source]

A deep convolutional neural network from [He2016].

The model expects images of shape [batch, channels, 224, 224].

[He2016]

Deep Residual Learning for Image Recognition. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2016. DOI: 10.1109/CVPR.2016.90

Parameters:

size (int) – size of the model. Must be one of [18, 34, 50, 101, 152].