ffnn#

class sparx.ffnn.FFNN(shape: tuple, weights: ndarray, bias: ndarray, activation_functions: list[str])#

Bases: object

feedforward neural network

add_layer(neuron_count: int, weights: ndarray, bias: ndarray, activation_function: str) None#

Extends the network with a new layer

Parameters:
  • neuron_count (int) – number of neurons in layer

  • weights (np.ndarray) – weight matrix between previous layer in keras format

  • bias (np.ndarray) – bias matrix for new layer in keras format

  • activation_function (str) – activation function to use in keras format

forward_pass(inputs: ndarray) ndarray#

Performs a forward pass through the network and return the activated output for each layer

Parameters:

inputs (np.ndarray) – The inputs to the network

Returns:

output labels

Return type:

np.ndarray

get_shape() tuple[int]#

Returns the shape of the network

Returns:

tuple with sizes of each layer

Return type:

tuple[int]