model.boolean_or

Attributes

feature

Classes

BooleanOrNN

Implements a neural network model designed to mimic the 'OR' logical operation on input features.

Module Contents

class model.boolean_or.BooleanOrNN(n_features: int = 2)

Bases: torch.nn.Sequential

Implements a neural network model designed to mimic the ‘OR’ logical operation on input features.

When only -1 or 1 are passed in as part of the input to this model, it is effectively performing the ‘OR’ operation.

This model is structured as a sequence of layers that progressively compute the ‘OR’ operation on the input features, scaling the dimensionality of the input at each step until the final output is obtained. The network employs a specific arrangement of weights and intermediate operations such that it is also equivalent to computing the maximum value among a collection of values given as as the input.

Inherits from:

torch.nn.Sequential: Parent class for implementing neural networks with modules defined in a sequential manner.

dims

A list that keeps track of the dimensions of each layer in the network.

Type:

list

Initializes an AND model with the specified input features dimension.

Parameters:

n_features (int) – The dimension (number of features) of the input data. Defaults to 2.

n_features = 2
_create_layer_weights() Tuple

Initializes the layers of the network starting from the input dimension.

Parameters:

in_dim (int) – The dimension of the input to the current layer.

Returns:

A list of initialized layers that make up the network.

Return type:

list

model.boolean_or.feature = 3